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 ::memset(m_pcRotorPositions, 0, m_unNumRotors *
sizeof(
CVector3));
21 m_pfRotorVelocities =
new Real[m_unNumRotors];
22 ::memset(m_pfRotorVelocities, 0, m_unNumRotors *
sizeof(
Real));
30 const std::string& str_id,
31 size_t un_num_rotors) :
33 m_unNumRotors(un_num_rotors) {
34 m_pcRotorPositions =
new CVector3[m_unNumRotors];
35 ::memset(m_pcRotorPositions, 0, m_unNumRotors *
sizeof(
CVector3));
36 m_pfRotorVelocities =
new Real[m_unNumRotors];
37 ::memset(m_pfRotorVelocities, 0, m_unNumRotors *
sizeof(
Real));
45 delete[] m_pcRotorPositions;
46 delete[] m_pfRotorVelocities;
53 ::memset(m_pfRotorVelocities, 0, m_unNumRotors *
sizeof(
Real));
61 if(un_index < m_unNumRotors) {
62 m_pcRotorPositions[un_index] = c_position;
65 THROW_ARGOSEXCEPTION(
"CRotorEquippedEntity::SetRotor() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumRotors <<
"])");
73 if(un_index < m_unNumRotors) {
74 return m_pcRotorPositions[un_index];
77 THROW_ARGOSEXCEPTION(
"CRotorEquippedEntity::GetRotorPosition() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumRotors <<
"])");
85 if(un_index < m_unNumRotors) {
86 return m_pfRotorVelocities[un_index];
89 THROW_ARGOSEXCEPTION(
"CRotorEquippedEntity::GetRotorVelocity() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumRotors <<
"])");
97 ::memcpy(m_pfRotorVelocities, pf_velocities, m_unNumRotors *
sizeof(
Real));
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
void SetVelocities(Real *pf_velocities)
virtual ~CRotorEquippedEntity()
float Real
Collects all ARGoS code.
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
unsigned int UInt32
32-bit unsigned integer.
Basic class for an entity that contains other entities.
Real GetRotorVelocity(size_t un_index) const
const CVector3 & GetRotorPosition(size_t un_index) const
void Disable()
Disables the entity.
REGISTER_STANDARD_SPACE_OPERATIONS_ON_ENTITY(CEntity)
CRotorEquippedEntity(CComposableEntity *pc_parent, size_t un_num_rotors)
void SetRotor(UInt32 un_index, const CVector3 &c_position)
The namespace containing all the ARGoS related code.