8 #include <argos3/plugins/simulator/media/radio_medium.h>
9 #include <argos3/plugins/simulator/entities/radio_equipped_entity.h>
17 m_pcRadioEquippedEntity(nullptr) {
62 cTxRange *= (cRadio.
GetRange() * 0.5f);
79 s_interface.Data.clear();
86 CRadiosDefaultActuator::CTxOperation::CTxOperation(
const CRadioEntity& c_tx_radio,
87 const std::vector<CByteArray>& c_tx_data) :
88 m_cTxRadio(c_tx_radio),
89 m_cTxData(c_tx_data) {}
94 bool CRadiosDefaultActuator::CTxOperation::operator()(CRadioEntity& c_rx_radio) {
95 if(&c_rx_radio != &m_cTxRadio) {
96 const CVector3& cRxRadioPosition = c_rx_radio.GetPosition();
97 const CVector3& cTxRadioPosition = m_cTxRadio.GetPosition();
98 Real fDistance = (cRxRadioPosition - cTxRadioPosition).Length();
99 if(fDistance < m_cTxRadio.GetRange()) {
100 for(
const CByteArray& c_data : m_cTxData) {
101 c_rx_radio.ReceiveData(cTxRadioPosition, c_data);
113 "Michael Allwright [allsey87@gmail.com]",
116 "A generic radio actuator to send messages to nearby radios.",
117 "This radio actuator implementation allows an arbitary number of messages\n"
118 "containing an arbitary number of bytes to be sent to nearby radios. The\n"
119 "implementation of this actuator is very basic and any concepts such as\n"
120 "throughput, addressing, or formatting of a message's contents is beyond the\n"
121 "scope of this actuator's implementation.\n\n"
123 "REQUIRED XML CONFIGURATION\n\n"
126 " <my_controller ...>\n"
130 " <radios implementation=\"default\" medium=\"radios\" />\n"
134 " </my_controller>\n"
136 " </controllers>\n\n"
138 "The 'medium' attribute sets the id of the radio medium declared in the <media>\n"
141 "OPTIONAL XML CONFIGURATION\n\n"
#define THROW_ARGOSEXCEPTION_NESTED(message, nested)
This macro throws an ARGoS exception with the passed message and nesting the passed exception.
float Real
Collects all ARGoS code.
The namespace containing all the ARGoS related code.
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.
Basic class for an entity that contains other entities.
CEntity & GetComponent(const std::string &str_component)
Returns the component with the passed string label.
const CVector3 & GetPosition() const
A data structure that contains positional entities.
virtual void ForEntitiesInBoxRange(const CVector3 &c_center, const CVector3 &c_half_size, COperation &c_operation)=0
Executes an operation on all entities within the specified box range.
The exception that wraps all errors in ARGoS.
SInterface::TVector m_vecInterfaces
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.
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().
CRadioMedium & GetMedium() const
Returns the medium associated to this radio.
Real GetRange() const
Returns the transmission range of the radio.
A container of CRadioEntity.
SInstance::TVector & GetInstances()
Returns the radios.
CRadioEntity & GetRadio(UInt32 un_index)
Returns a radio by numeric index.
CPositionalIndex< CRadioEntity > & GetIndex()
Returns the radio positional index.