10 #include <argos3/core/wrappers/lua/lua_utility.h>
25 int LuaTurretSetRotation(lua_State* pt_lua_state) {
27 if(lua_gettop(pt_lua_state) != 1) {
28 return luaL_error(pt_lua_state,
"robot.turret.set_rotation() expects 1 argument");
30 luaL_checktype(pt_lua_state, 1, LUA_TNUMBER);
32 CLuaUtility::GetDeviceInstance<CCI_FootBotTurretActuator>(pt_lua_state,
"turret")->
33 SetRotation(CRadians(lua_tonumber(pt_lua_state, 1)));
39 int LuaTurretSetRotationSpeed(lua_State* pt_lua_state) {
41 if(lua_gettop(pt_lua_state) != 1) {
42 return luaL_error(pt_lua_state,
"robot.turret.set_rotation_speed() expects 1 argument");
44 luaL_checktype(pt_lua_state, 1, LUA_TNUMBER);
46 CLuaUtility::GetDeviceInstance<CCI_FootBotTurretActuator>(pt_lua_state,
"turret")->
47 SetRotationSpeed(lua_tonumber(pt_lua_state, 1));
53 int LuaTurretSetSpeedControlMode(lua_State* pt_lua_state) {
55 if(lua_gettop(pt_lua_state) != 0) {
56 return luaL_error(pt_lua_state,
"robot.turret.set_speed_control_mode() expects no arguments");
59 CLuaUtility::GetDeviceInstance<CCI_FootBotTurretActuator>(pt_lua_state,
"turret")->
60 SetSpeedControlMode();
66 int LuaTurretSetPositionControlMode(lua_State* pt_lua_state) {
68 if(lua_gettop(pt_lua_state) != 0) {
69 return luaL_error(pt_lua_state,
"robot.turret.set_position_control_mode() expects no arguments");
72 CLuaUtility::GetDeviceInstance<CCI_FootBotTurretActuator>(pt_lua_state,
"turret")->
73 SetPositionControlMode();
79 int LuaTurretSetPassiveMode(lua_State* pt_lua_state) {
81 if(lua_gettop(pt_lua_state) != 0) {
82 return luaL_error(pt_lua_state,
"robot.turret.set_passive_mode() expects no arguments");
85 CLuaUtility::GetDeviceInstance<CCI_FootBotTurretActuator>(pt_lua_state,
"turret")->
123 #ifdef ARGOS_WITH_LUA
124 void CCI_FootBotTurretActuator::CreateLuaState(lua_State* pt_lua_state) {
The namespace containing all the ARGoS related code.
It defines the basic type CRadians, used to store an angle value in radians.
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.
void SetPassiveMode()
Sets the turret control mode to passive.
static const CRange< SInt32 > SPEED_RANGE
void SetActiveWithRotation(const CRadians &c_angle)
Sets the turret control mode to active, and sets the target rotation to the given one.
void SetSpeedControlMode()
Sets the turret control mode to speed control.
virtual void SetMode(ETurretModes e_mode)=0
Sets the turret control mode Modes are: angular position control, rotation speed control,...
virtual void SetRotation(const CRadians &c_angle)=0
Sets the turret rotation Turret rotation is expressed in radians, positive values rotate the turret c...
static const CRange< Real > NORMALIZED_SPEED_RANGE
void SetPositionControlMode()
Sets the turret control mode to position control.