8 #include <argos3/core/simulator/space/space.h>
16 size_t un_num_rotors) :
18 m_unNumRotors(un_num_rotors) {
19 m_pcRotorPositions =
new CVector3[m_unNumRotors];
20 m_pfRotorVelocities =
new Real[m_unNumRotors];
21 ::memset(m_pfRotorVelocities, 0, m_unNumRotors *
sizeof(
Real));
29 const std::string& str_id,
30 size_t un_num_rotors) :
32 m_unNumRotors(un_num_rotors) {
33 m_pcRotorPositions =
new CVector3[m_unNumRotors];
34 m_pfRotorVelocities =
new Real[m_unNumRotors];
35 ::memset(m_pfRotorVelocities, 0, m_unNumRotors *
sizeof(
Real));
43 delete[] m_pcRotorPositions;
44 delete[] m_pfRotorVelocities;
51 ::memset(m_pfRotorVelocities, 0, m_unNumRotors *
sizeof(
Real));
59 if(un_index < m_unNumRotors) {
60 m_pcRotorPositions[un_index] = c_position;
63 THROW_ARGOSEXCEPTION(
"CRotorEquippedEntity::SetRotor() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumRotors <<
"])");
71 if(un_index < m_unNumRotors) {
72 return m_pcRotorPositions[un_index];
75 THROW_ARGOSEXCEPTION(
"CRotorEquippedEntity::GetRotorPosition() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumRotors <<
"])");
83 if(un_index < m_unNumRotors) {
84 return m_pfRotorVelocities[un_index];
87 THROW_ARGOSEXCEPTION(
"CRotorEquippedEntity::GetRotorVelocity() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumRotors <<
"])");
95 ::memcpy(m_pfRotorVelocities, pf_velocities, m_unNumRotors *
sizeof(
Real));
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
unsigned int UInt32
32-bit unsigned integer.
float Real
Collects all ARGoS code.
The namespace containing all the ARGoS related code.
REGISTER_STANDARD_SPACE_OPERATIONS_ON_ENTITY(CEntity)
Basic class for an entity that contains other entities.
void Disable()
Disables the entity.
void SetRotor(UInt32 un_index, const CVector3 &c_position)
Real GetRotorVelocity(size_t un_index) const
CRotorEquippedEntity(CComposableEntity *pc_parent, size_t un_num_rotors)
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
const CVector3 & GetRotorPosition(size_t un_index) const
virtual ~CRotorEquippedEntity()
void SetVelocities(Real *pf_velocities)