00001 #ifndef SCORBOTCONTROLLER_H 00002 #define SCORBOTCONTROLLER_H 00003 00004 #include "Component/ModelComponent.H" 00005 #include "Component/ModelParam.H" 00006 #include "Robots/RobotBrain/RobotBrainComponent.H" 00007 #include "Ice/RobotBrainObjects.ice.H" 00008 #include "Ice/RobotSimEvents.ice.H" 00009 #include "Ice/IceImageUtils.H" 00010 #include <IceUtil/Thread.h> 00011 #include "Component/ModelOptionDef.H" 00012 00013 #include "Devices/Serial.H" 00014 #include "Ice/Scorbot.ice.H" 00015 00016 00017 class ScorbotController : public RobotBrainComponent 00018 { 00019 public: 00020 ScorbotController(OptionManager& mgr, 00021 const std::string& descrName = "ScorbotController", 00022 const std::string& tagName = "ScorbotController"); 00023 00024 ~ScorbotController(); 00025 00026 void start1(); 00027 00028 void evolve(); 00029 00030 void updateMessage(const RobotSimEvents::EventMessagePtr& eMsg, 00031 const Ice::Current&); 00032 00033 void registerTopics(); 00034 00035 private: 00036 OModelParam<std::string> itsSerialDev; 00037 00038 nub::soft_ref<Serial> itsSerial; //our serial controller 00039 00040 void setMotor(JOINT m, int pwm); 00041 void stopAllMotors(); 00042 int getMicroSwitch(); 00043 int getEncoder(JOINT m); 00044 void setSafety(bool val); 00045 int getPWM(JOINT m); 00046 void resetEncoders(); 00047 void stopAllMotors(); 00048 void setSafety(bool val); 00049 int getPWM(JOINT m); 00050 } 00051 00052 #endif 00053