ARGoS 3
A parallel, multi-engine simulator for swarm robotics
ci_footbot_turret_encoder_sensor.cpp
Go to the documentation of this file.
1
8
9#ifdef ARGOS_WITH_LUA
10#include <argos3/core/wrappers/lua/lua_utility.h>
11#endif
12
13namespace argos {
14
15 /****************************************/
16 /****************************************/
17
18 const CRange<CRadians> CCI_FootBotTurretEncoderSensor::ANGULAR_RANGE(CRadians(-ARGOS_PI), CRadians(ARGOS_PI));
19
20 /****************************************/
21 /****************************************/
22
26
27 /****************************************/
28 /****************************************/
29
30#ifdef ARGOS_WITH_LUA
31 void CCI_FootBotTurretEncoderSensor::CreateLuaState(lua_State* pt_lua_state) {
32 CLuaUtility::OpenRobotStateTable(pt_lua_state, "turret");
33 CLuaUtility::AddToTable(pt_lua_state, "rotation", m_cRotation);
35 }
36#endif
37
38 /****************************************/
39 /****************************************/
40
41#ifdef ARGOS_WITH_LUA
42 void CCI_FootBotTurretEncoderSensor::ReadingsToLuaState(lua_State* pt_lua_state) {
43 lua_getfield(pt_lua_state, -1, "turret");
44 lua_pushnumber(pt_lua_state, m_cRotation.GetValue());
45 lua_setfield(pt_lua_state, -2, "rotation");
46 lua_pop(pt_lua_state, 1);
47 }
48#endif
49
50
51 /****************************************/
52 /****************************************/
53
54}
#define ARGOS_PI
To be used when initializing static variables.
Definition angles.h:32
The namespace containing all the ARGoS related code.
Definition ci_actuator.h:12
It defines the basic type CRadians, used to store an angle value in radians.
Definition angles.h:42
Real GetValue() const
Returns the value in radians.
Definition angles.h:111
static void AddToTable(lua_State *pt_state, const std::string &str_key, void *pt_data)
Adds a pointer to a chunk of data with the given string key to the table located at the top of the st...
static void OpenRobotStateTable(lua_State *pt_state, const std::string &str_key)
Opens a table in the robot state, creating it if it does not exist.
static void CloseRobotStateTable(lua_State *pt_state)
Closes a table in the robot state.