ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
00001 00007 #include "footbot_turret_encoder_default_sensor.h" 00008 #include <argos3/core/simulator/entity/composable_entity.h> 00009 00010 namespace argos { 00011 00012 /****************************************/ 00013 /****************************************/ 00014 00015 CFootBotTurretEncoderDefaultSensor::CFootBotTurretEncoderDefaultSensor() : 00016 m_pcTurretEntity(NULL) {} 00017 00018 /****************************************/ 00019 /****************************************/ 00020 00021 void CFootBotTurretEncoderDefaultSensor::SetRobot(CComposableEntity& c_entity) { 00022 m_pcTurretEntity = &(c_entity.GetComponent<CFootBotTurretEntity>("turret")); 00023 m_pcTurretEntity->SetCanBeEnabledIfDisabled(true); 00024 m_pcTurretEntity->Enable(); 00025 } 00026 00027 /****************************************/ 00028 /****************************************/ 00029 00030 void CFootBotTurretEncoderDefaultSensor::Update() { 00031 m_cRotation = m_pcTurretEntity->GetRotation(); 00032 } 00033 00034 /****************************************/ 00035 /****************************************/ 00036 00037 void CFootBotTurretEncoderDefaultSensor::Reset() { 00038 m_cRotation = CRadians::ZERO; 00039 } 00040 00041 /****************************************/ 00042 /****************************************/ 00043 00044 REGISTER_SENSOR(CFootBotTurretEncoderDefaultSensor, 00045 "footbot_turret_encoder", "default", 00046 "Carlo Pinciroli [ilpincy@gmail.com]", 00047 "1.0", 00048 "The foot-bot turret encoder sensor.", 00049 "This sensor accesses the foot-bot turret encoder. For a complete\n" 00050 "description of its usage, refer to the ci_footbot_turret_encoder_sensor\n" 00051 "file.\n\n" 00052 "REQUIRED XML CONFIGURATION\n\n" 00053 " <controllers>\n" 00054 " ...\n" 00055 " <my_controller ...>\n" 00056 " ...\n" 00057 " <sensors>\n" 00058 " ...\n" 00059 " <footbot_turret implementation=\"default\" />\n" 00060 " ...\n" 00061 " </sensors>\n" 00062 " ...\n" 00063 " </my_controller>\n" 00064 " ...\n" 00065 " </controllers>\n\n" 00066 "OPTIONAL XML CONFIGURATION\n\n" 00067 "None for the time being.\n", 00068 "Usable" 00069 ); 00070 00071 }