ci_camera_sensor.cpp
Go to the documentation of this file.
1 
7 #include <algorithm>
8 
9 #include "ci_camera_sensor.h"
10 
11 #ifdef ARGOS_WITH_LUA
12 #include <argos3/core/wrappers/lua/lua_utility.h>
13 #endif
14 
15 namespace argos {
16 
17  /****************************************/
18  /****************************************/
19 
21  return m_vecInterfaces;
22  }
23 
24  /****************************************/
25  /****************************************/
26 
27 #ifdef ARGOS_WITH_LUA
28  void CCI_CameraSensor::CreateLuaState(lua_State* pt_lua_state) {
29  CLuaUtility::OpenRobotStateTable(pt_lua_state, "cameras");
30  for(SInterface& s_interface : m_vecInterfaces) {
31  CLuaUtility::StartTable(pt_lua_state, s_interface.Id);
32  for(CCI_CameraSensorAlgorithm* pc_algorithm : s_interface.Algorithms) {
33  CLuaUtility::StartTable(pt_lua_state, pc_algorithm->GetId());
34  pc_algorithm->CreateLuaState(pt_lua_state);
35  CLuaUtility::EndTable(pt_lua_state);
36  }
37  CLuaUtility::EndTable(pt_lua_state);
38  }
40  }
41 #endif
42 
43  /****************************************/
44  /****************************************/
45 
46 #ifdef ARGOS_WITH_LUA
47  void CCI_CameraSensor::ReadingsToLuaState(lua_State* pt_lua_state) {
48  CLuaUtility::OpenRobotStateTable(pt_lua_state, "cameras");
49  for(SInterface& s_interface : m_vecInterfaces) {
50  CLuaUtility::StartTable(pt_lua_state, s_interface.Id);
51  for(CCI_CameraSensorAlgorithm* pc_algorithm : s_interface.Algorithms) {
52  CLuaUtility::StartTable(pt_lua_state, pc_algorithm->GetId());
53  pc_algorithm->ReadingsToLuaState(pt_lua_state);
54  CLuaUtility::EndTable(pt_lua_state);
55  }
56  CLuaUtility::EndTable(pt_lua_state);
57  }
59  }
60 #endif
61 
62  /****************************************/
63  /****************************************/
64 
65 }
const SInterface::TVector & GetInterfaces() const
Returns a const reference to the camera interfaces.
std::vector< SInterface > TVector
SInterface::TVector m_vecInterfaces
static void StartTable(lua_State *pt_state, const std::string &str_key)
Adds a table with the given string key to the table located at the top of the stack.
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.
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
static void CloseRobotStateTable(lua_State *pt_state)
Closes a table in the robot state.
static void EndTable(lua_State *pt_state)
Adds a table to the Lua stack.