ARGoS  3
A parallel, multi-engine simulator for swarm robotics
plugins/robots/foot-bot/simulator/footbot_distance_scanner_equipped_entity.cpp
Go to the documentation of this file.
00001 
00007 #include "footbot_distance_scanner_equipped_entity.h"
00008 #include <argos3/core/simulator/physics_engine/physics_engine.h>
00009 #include <argos3/core/simulator/space/space.h>
00010 
00011 namespace argos {
00012 
00013    /****************************************/
00014    /****************************************/
00015 
00016    CFootBotDistanceScannerEquippedEntity::CFootBotDistanceScannerEquippedEntity(CComposableEntity* pc_parent) :
00017       CEntity(pc_parent),
00018       m_unMode(MODE_OFF),
00019       m_fRotationSpeed(0.0f) {
00020       Disable();
00021       SetCanBeEnabledIfDisabled(false);
00022    }
00023    
00024    /****************************************/
00025    /****************************************/
00026 
00027    CFootBotDistanceScannerEquippedEntity::CFootBotDistanceScannerEquippedEntity(CComposableEntity* pc_parent,
00028                                                                   const std::string& str_id) :
00029       CEntity(pc_parent, str_id),
00030       m_unMode(MODE_OFF),
00031       m_fRotationSpeed(0.0f) {
00032       Disable();
00033       SetCanBeEnabledIfDisabled(false);
00034    }
00035    
00036    /****************************************/
00037    /****************************************/
00038 
00039    void CFootBotDistanceScannerEquippedEntity::Reset() {
00040       m_unMode = MODE_OFF;
00041       m_cRotation = CRadians::ZERO;
00042       m_fRotationSpeed = 0.0f;
00043    }
00044 
00045    /****************************************/
00046    /****************************************/
00047 
00048    void CFootBotDistanceScannerEquippedEntity::Update() {
00049       if(m_unMode == MODE_SPEED_CONTROL &&
00050          m_fRotationSpeed != 0.0f) {
00051          m_cRotation += CRadians(m_fRotationSpeed *
00052                                  CPhysicsEngine::GetSimulationClockTick());
00053          m_cRotation.UnsignedNormalize();
00054       }
00055    }
00056 
00057    /****************************************/
00058    /****************************************/
00059 
00060    void CFootBotDistanceScannerEquippedEntity::SetRotation(const CRadians& c_rotation) {
00061       m_cRotation = c_rotation;
00062       m_cRotation.UnsignedNormalize();
00063    }
00064 
00065    /****************************************/
00066    /****************************************/
00067 
00068    REGISTER_STANDARD_SPACE_OPERATIONS_ON_ENTITY(CFootBotDistanceScannerEquippedEntity);
00069 
00070    /****************************************/
00071    /****************************************/
00072 
00073 }