directional_leds_default_actuator.cpp
Go to the documentation of this file.
1 
8 #include <argos3/core/simulator/simulator.h>
9 #include <argos3/plugins/simulator/media/directional_led_medium.h>
10 
11 namespace argos {
12 
13  /****************************************/
14  /****************************************/
15 
17  m_pcDirectionalLEDEquippedEntity(nullptr) {}
18 
19  /****************************************/
20  /****************************************/
21 
23  m_pcDirectionalLEDEquippedEntity =
24  &(c_entity.GetComponent<CDirectionalLEDEquippedEntity>("directional_leds"));
25  m_tSettings.reserve(m_pcDirectionalLEDEquippedEntity->GetInstances().size());
26  /* populate m_tSettings with the initial configuration */
27  for(const CDirectionalLEDEquippedEntity::SInstance& s_instance :
28  m_pcDirectionalLEDEquippedEntity->GetInstances()) {
29  m_tSettings.push_back(s_instance.LED.GetColor());
30  }
32  }
33 
34  /****************************************/
35  /****************************************/
36 
38  try {
40  }
41  catch(CARGoSException& ex) {
42  THROW_ARGOSEXCEPTION_NESTED("Error initializing the directional LEDs default actuator", ex);
43  }
44  }
45 
46  /****************************************/
47  /****************************************/
48 
50  m_pcDirectionalLEDEquippedEntity->SetLEDColors(m_tSettings);
51  }
52 
53  /****************************************/
54  /****************************************/
55 
58  }
59 
60  /****************************************/
61  /****************************************/
62 
64  "directional_leds", "default",
65  "Michael Allwright [allsey87@gmail.com]",
66  "1.0",
67  "The directional LEDs actuator.",
68 
69  "This actuator controls a group of directional LEDs. For a complete description\n"
70  "of its usage, refer to the ci_leds_actuator.h file.\n\n"
71 
72  "REQUIRED XML CONFIGURATION\n\n"
73  " <controllers>\n"
74  " ...\n"
75  " <my_controller ...>\n"
76  " ...\n"
77  " <actuators>\n"
78  " ...\n"
79  " <leds implementation=\"default\" />\n"
80  " ...\n"
81  " </actuators>\n"
82  " ...\n"
83  " </my_controller>\n"
84  " ...\n"
85  " </controllers>\n\n"
86 
87  "The 'medium' attribute sets the id of the LED medium declared in the <media>\n"
88  "XML section.\n\n"
89 
90  "OPTIONAL XML CONFIGURATION\n\n"
91 
92  "None.\n",
93  "Usable"
94  );
95 
96  /****************************************/
97  /****************************************/
98 
99 }
#define THROW_ARGOSEXCEPTION_NESTED(message, nested)
This macro throws an ARGoS exception with the passed message and nesting the passed exception.
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
REGISTER_ACTUATOR(CFootBotDistanceScannerDefaultActuator, "footbot_distance_scanner", "default", "Carlo Pinciroli [ilpincy@gmail.com]", "1.0", "The foot-bot distance scanner actuator.", "This actuator controls the foot-bot distance scanner. For a complete\n" "description of its usage, refer to the ci_footbot_distance_scanner_actuator\n" "file.\n\n" "REQUIRED XML CONFIGURATION\n\n" " <controllers>\n" " ...\n" " <my_controller ...>\n" " ...\n" " <actuators>\n" " ...\n" " <footbot_distance_scanner implementation=\"default\" />\n" " ...\n" " </actuators>\n" " ...\n" " </my_controller>\n" " ...\n" " </controllers>\n\n" "OPTIONAL XML CONFIGURATION\n\n" "None for the time being.\n", "Usable")
virtual void Init(TConfigurationNode &t_node)
Initializes the actuator from the XML configuration tree.
Definition: ci_actuator.h:54
Basic class for an entity that contains other entities.
CEntity & GetComponent(const std::string &str_component)
Returns the component with the passed string label.
The exception that wraps all errors in ARGoS.
virtual void SetAllColors(const CColor &c_color)
Sets the color of the whole LED ring.
virtual void Update()
Updates the state of the entity associated to this actuator.
virtual void Reset()
Resets the actuator to the state it had just after Init().
virtual void SetRobot(CComposableEntity &c_entity)
Sets the entity associated to this actuator.
virtual void Init(TConfigurationNode &t_tree)
Initializes the actuator from the XML configuration tree.
A container of CDirectionalLEDEntity.
void SetLEDColors(const CColor &c_color)
Sets the color of all the LEDs to the same value.
SInstance::TVector & GetInstances()
Returns all the LEDs.