Warning: include(php/utility.php): Failed to open stream: No such file or directory in /home/argos/argos3/doc/api/embedded/a00678_source.php on line 2

Warning: include(): Failed opening 'php/utility.php' for inclusion (include_path='.:/usr/lib64/php') in /home/argos/argos3/doc/api/embedded/a00678_source.php on line 2
The ARGoS Website

leds_default_actuator.cpp
Go to the documentation of this file.
1 
8 #include <argos3/core/simulator/simulator.h>
9 #include <argos3/core/utility/logging/argos_log.h>
10 #include <argos3/plugins/simulator/media/led_medium.h>
11 
12 namespace argos {
13 
14  /****************************************/
15  /****************************************/
16 
18  m_pcLEDEquippedEntity(NULL) {}
19 
20  /****************************************/
21  /****************************************/
22 
24  m_pcLEDEquippedEntity = &(c_entity.GetComponent<CLEDEquippedEntity>("leds"));
25  m_tSettings.resize(m_pcLEDEquippedEntity->GetLEDs().size());
26  }
27 
28  /****************************************/
29  /****************************************/
30 
32  try {
33  CCI_LEDsActuator::Init(t_tree);
34  std::string strMedium;
35  GetNodeAttribute(t_tree, "medium", strMedium);
36  m_pcLEDMedium = &CSimulator::GetInstance().GetMedium<CLEDMedium>(strMedium);
37  m_pcLEDEquippedEntity->SetMedium(*m_pcLEDMedium);
38  m_pcLEDEquippedEntity->Enable();
39  }
40  catch(CARGoSException& ex) {
41  THROW_ARGOSEXCEPTION_NESTED("Error initializing the LEDs default actuator", ex);
42  }
43  }
44 
45  /****************************************/
46  /****************************************/
47 
49  m_pcLEDEquippedEntity->SetAllLEDsColors(m_tSettings);
50  }
51 
52  /****************************************/
53  /****************************************/
54 
57  }
58 
59  /****************************************/
60  /****************************************/
61 
63  m_pcLEDEquippedEntity->Disable();
64  }
65 
66  /****************************************/
67  /****************************************/
68 
69 }
70 
71 REGISTER_ACTUATOR(CLEDsDefaultActuator,
72  "leds", "default",
73  "Carlo Pinciroli [ilpincy@gmail.com]",
74  "1.0",
75  "The LEDs actuator.",
76  "This actuator controls a group of LEDs. For a complete description of its\n"
77  "usage, refer to the ci_leds_actuator.h file.\n\n"
78  "REQUIRED XML CONFIGURATION\n\n"
79  " <controllers>\n"
80  " ...\n"
81  " <my_controller ...>\n"
82  " ...\n"
83  " <actuators>\n"
84  " ...\n"
85  " <leds implementation=\"default\"\n"
86  " medium=\"leds\" />\n"
87  " ...\n"
88  " </actuators>\n"
89  " ...\n"
90  " </my_controller>\n"
91  " ...\n"
92  " </controllers>\n\n"
93  "The 'medium' attribute sets the id of the LED medium declared in the <media>\n"
94  "XML section.\n\n"
95  "OPTIONAL XML CONFIGURATION\n\n"
96  "None.\n",
97  "Usable"
98  );
99 
virtual void SetAllColors(const CColor &c_color)
Sets the color of the whole LED ring.
virtual void Reset()
Resets the actuator to the state it had just after Init().
static CColor BLACK
Definition: color.h:29
virtual void Init(TConfigurationNode &t_tree)
Initializes the actuator from the XML configuration tree.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
#define THROW_ARGOSEXCEPTION_NESTED(message, nested)
This macro throws an ARGoS exception with the passed message and nesting the passed exception...
void SetMedium(CLEDMedium &c_medium)
Sets the medium associated to this entity.
virtual void Init(TConfigurationNode &t_node)
Initializes the actuator from the XML configuration tree.
Definition: ci_actuator.h:54
virtual void SetRobot(CComposableEntity &c_entity)
Sets the entity associated to this actuator.
A container of CLEDEntity.
Basic class for an entity that contains other entities.
void GetNodeAttribute(TConfigurationNode &t_node, const std::string &str_attribute, T &t_buffer)
Returns the value of a node's attribute.
The exception that wraps all errors in ARGoS.
SActuator::TList & GetLEDs()
Returns all the LEDs.
T & GetMedium(const std::string &str_id)
Returns a reference to a medium.
Definition: simulator.h:129
void SetAllLEDsColors(const CColor &c_color)
Sets the color of all the LEDs to the same value.
virtual void Update()
Updates the state of the entity associated to this actuator.
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
virtual void Destroy()
Destroys the actuator.
REGISTER_ACTUATOR(CLEDsDefaultActuator,"leds","default","Carlo Pinciroli [ilpincy@gmail.com]","1.0","The LEDs actuator.","This actuator controls a group of LEDs. For a complete description of its\n""usage, refer to the ci_leds_actuator.h file.\n\n""REQUIRED XML CONFIGURATION\n\n"" <controllers>\n"" ...\n"" <my_controller ...>\n"" ...\n"" <actuators>\n"" ...\n"" <leds implementation=\"default\"\n"" medium=\"leds\" />\n"" ...\n"" </actuators>\n"" ...\n"" </my_controller>\n"" ...\n"" </controllers>\n\n""The 'medium' attribute sets the id of the LED medium declared in the <media>\n""XML section.\n\n""OPTIONAL XML CONFIGURATION\n\n""None.\n","Usable")
static CSimulator & GetInstance()
Returns the instance to the CSimulator class.
Definition: simulator.cpp:78
CEntity & GetComponent(const std::string &str_component)
Returns the component with the passed string label.