8 #include <argos3/core/simulator/space/space.h>
16 size_t un_num_wheels) :
18 m_unNumWheels(un_num_wheels) {
19 m_pcWheelPositions =
new CVector3[m_unNumWheels];
20 ::memset(m_pcWheelPositions, 0, m_unNumWheels *
sizeof(
CVector3));
21 m_pfWheelRadia =
new Real[m_unNumWheels];
22 ::memset(m_pfWheelRadia, 0, m_unNumWheels *
sizeof(
Real));
23 m_pfWheelVelocities =
new Real[m_unNumWheels];
24 ::memset(m_pfWheelVelocities, 0, m_unNumWheels *
sizeof(
Real));
32 const std::string& str_id,
33 size_t un_num_wheels) :
35 m_unNumWheels(un_num_wheels) {
36 m_pcWheelPositions =
new CVector3[m_unNumWheels];
37 ::memset(m_pcWheelPositions, 0, m_unNumWheels *
sizeof(
CVector3));
38 m_pfWheelRadia =
new Real[m_unNumWheels];
39 ::memset(m_pfWheelRadia, 0, m_unNumWheels *
sizeof(
Real));
40 m_pfWheelVelocities =
new Real[m_unNumWheels];
41 ::memset(m_pfWheelVelocities, 0, m_unNumWheels *
sizeof(
Real));
49 delete[] m_pcWheelPositions;
50 delete[] m_pfWheelRadia;
51 delete[] m_pfWheelVelocities;
58 ::memset(m_pfWheelVelocities, 0, m_unNumWheels *
sizeof(
Real));
67 if(un_index < m_unNumWheels) {
68 m_pcWheelPositions[un_index] = c_position;
69 m_pfWheelRadia[un_index] = f_radius;
72 THROW_ARGOSEXCEPTION(
"CWheeledEntity::SetWheel() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumWheels <<
"])");
80 if(un_index < m_unNumWheels) {
81 return m_pcWheelPositions[un_index];
84 THROW_ARGOSEXCEPTION(
"CWheeledEntity::GetWheelPosition() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumWheels <<
"])");
92 if(un_index < m_unNumWheels) {
93 return m_pfWheelRadia[un_index];
96 THROW_ARGOSEXCEPTION(
"CWheeledEntity::GetWheelRadius() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumWheels <<
"])");
104 if(un_index < m_unNumWheels) {
105 return m_pfWheelVelocities[un_index];
108 THROW_ARGOSEXCEPTION(
"CWheeledEntity::GetWheelVelocity() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumWheels <<
"])");
116 ::memcpy(m_pfWheelVelocities, pf_velocities, m_unNumWheels *
sizeof(
Real));
virtual ~CWheeledEntity()
float Real
Collects all ARGoS code.
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
void SetWheel(UInt32 un_index, const CVector3 &c_position, Real f_radius)
Real GetWheelRadius(size_t un_index) const
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
unsigned int UInt32
32-bit unsigned integer.
CWheeledEntity(CComposableEntity *pc_parent, size_t un_num_wheels)
Real GetWheelVelocity(size_t un_index) const
Basic class for an entity that contains other entities.
void Disable()
Disables the entity.
REGISTER_STANDARD_SPACE_OPERATIONS_ON_ENTITY(CEntity)
The namespace containing all the ARGoS related code.
const CVector3 & GetWheelPosition(size_t un_index) const
void SetVelocities(Real *pf_velocities)