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 m_pfWheelRadia =
new Real[m_unNumWheels];
21 ::memset(m_pfWheelRadia, 0, m_unNumWheels *
sizeof(
Real));
22 m_pfWheelVelocities =
new Real[m_unNumWheels];
23 ::memset(m_pfWheelVelocities, 0, m_unNumWheels *
sizeof(
Real));
31 const std::string& str_id,
32 size_t un_num_wheels) :
34 m_unNumWheels(un_num_wheels) {
35 m_pcWheelPositions =
new CVector3[m_unNumWheels];
36 m_pfWheelRadia =
new Real[m_unNumWheels];
37 ::memset(m_pfWheelRadia, 0, m_unNumWheels *
sizeof(
Real));
38 m_pfWheelVelocities =
new Real[m_unNumWheels];
39 ::memset(m_pfWheelVelocities, 0, m_unNumWheels *
sizeof(
Real));
47 delete[] m_pcWheelPositions;
48 delete[] m_pfWheelRadia;
49 delete[] m_pfWheelVelocities;
56 ::memset(m_pfWheelVelocities, 0, m_unNumWheels *
sizeof(
Real));
65 if(un_index < m_unNumWheels) {
66 m_pcWheelPositions[un_index] = c_position;
67 m_pfWheelRadia[un_index] = f_radius;
70 THROW_ARGOSEXCEPTION(
"CWheeledEntity::SetWheel() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumWheels <<
"])");
78 if(un_index < m_unNumWheels) {
79 return m_pcWheelPositions[un_index];
82 THROW_ARGOSEXCEPTION(
"CWheeledEntity::GetWheelPosition() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumWheels <<
"])");
90 if(un_index < m_unNumWheels) {
91 return m_pfWheelRadia[un_index];
94 THROW_ARGOSEXCEPTION(
"CWheeledEntity::GetWheelRadius() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumWheels <<
"])");
102 if(un_index < m_unNumWheels) {
103 return m_pfWheelVelocities[un_index];
106 THROW_ARGOSEXCEPTION(
"CWheeledEntity::GetWheelVelocity() : index " << un_index <<
" out of bounds (allowed [0:" << m_unNumWheels <<
"])");
114 ::memcpy(m_pfWheelVelocities, pf_velocities, m_unNumWheels *
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.
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
virtual ~CWheeledEntity()
Real GetWheelRadius(size_t un_index) const
CWheeledEntity(CComposableEntity *pc_parent, size_t un_num_wheels)
const CVector3 & GetWheelPosition(size_t un_index) const
void SetWheel(UInt32 un_index, const CVector3 &c_position, Real f_radius)
void SetVelocities(Real *pf_velocities)
Real GetWheelVelocity(size_t un_index) const