ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
00001 00007 #include "ci_footbot_wheel_speed_sensor.h" 00008 00009 #ifdef ARGOS_WITH_LUA 00010 #include <argos3/core/wrappers/lua/lua_utility.h> 00011 #endif 00012 00013 namespace argos { 00014 00015 /****************************************/ 00016 /****************************************/ 00017 00018 #ifdef ARGOS_WITH_LUA 00019 void CCI_FootBotWheelSpeedSensor::CreateLuaState(lua_State* pt_lua_state) { 00020 CLuaUtility::OpenRobotStateTable (pt_lua_state, "wheels" ); 00021 CLuaUtility::AddToTable (pt_lua_state, "velocity_left", m_sReading.LinearVelocityLeft ); 00022 CLuaUtility::AddToTable (pt_lua_state, "velocity_right", m_sReading.LinearVelocityRight); 00023 CLuaUtility::CloseRobotStateTable(pt_lua_state ); 00024 } 00025 #endif 00026 00027 /****************************************/ 00028 /****************************************/ 00029 00030 #ifdef ARGOS_WITH_LUA 00031 void CCI_FootBotWheelSpeedSensor::ReadingsToLuaState(lua_State* pt_lua_state) { 00032 lua_getfield(pt_lua_state, -1, "wheels"); 00033 lua_pushnumber(pt_lua_state, m_sReading.LinearVelocityLeft); 00034 lua_setfield(pt_lua_state, -2, "velocity_left"); 00035 lua_pushnumber(pt_lua_state, m_sReading.LinearVelocityRight); 00036 lua_setfield(pt_lua_state, -2, "velocity_right"); 00037 lua_pop(pt_lua_state, 1); 00038 } 00039 #endif 00040 00041 00042 /****************************************/ 00043 /****************************************/ 00044 00045 }