Go to the documentation of this file.00001
00010 #ifndef SERVO_CONTROLLER_H
00011 #define SERVO_CONTROLLER_H
00012
00013 #include <rtm/idl/BasicDataType.hh>
00014 #include <rtm/idl/ExtendedDataTypes.hh>
00015 #include <rtm/Manager.h>
00016 #include <rtm/DataFlowComponentBase.h>
00017 #include <rtm/CorbaPort.h>
00018 #include <rtm/DataInPort.h>
00019 #include <rtm/DataOutPort.h>
00020 #include <rtm/idl/BasicDataTypeSkel.h>
00021 #include <rtm/idl/ExtendedDataTypesSkel.h>
00022
00023
00024
00025 #include "ServoControllerService_impl.h"
00026
00027
00028
00029
00030
00031
00032
00033
00034 using namespace RTC;
00035
00036 class ServoSerial;
00037
00041 class ServoController
00042 : public RTC::DataFlowComponentBase
00043 {
00044 public:
00049 ServoController(RTC::Manager* manager);
00053 virtual ~ServoController();
00054
00055
00056
00057 virtual RTC::ReturnCode_t onInitialize();
00058
00059
00060
00061 virtual RTC::ReturnCode_t onFinalize();
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
00074
00075
00076
00077 virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
00078
00079
00080
00081 virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 bool setJointAngle(short id, double angle, double tm);
00104 bool setJointAngles(const OpenHRP::ServoControllerService::dSequence angles, double tm);
00105 bool getJointAngle(short id, double &angle);
00106 bool getJointAngles(OpenHRP::ServoControllerService::dSequence_out &angles);
00107 bool addJointGroup(const char *gname, const ::OpenHRP::ServoControllerService::iSequence ids);
00108 bool removeJointGroup(const char *gname);
00109 bool setJointAnglesOfGroup(const char *gname, const ::OpenHRP::ServoControllerService::dSequence angles, double tm);
00110 bool setMaxTorque(short id, short percentage);
00111 bool setReset(short id);
00112 bool getDuration(short id, double &duration);
00113 bool getSpeed(short id, double &speed);
00114 bool getMaxTorque(short id, short &percentage);
00115 bool getTorque(short id, double &torque);
00116 bool getTemperature(short id, double &temperature);
00117 bool getVoltage(short id, double &voltage);
00118 bool servoOn();
00119 bool servoOff();
00120
00121 protected:
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 RTC::CorbaPort m_ServoControllerServicePort;
00145
00146
00147
00148
00149
00150 ServoControllerService_impl m_service0;
00151
00152
00153
00154 private:
00155 std::map<std::string, std::vector<int> > joint_groups;
00156 std::vector<int> servo_id;
00157 std::vector<double> servo_offset;
00158 std::vector<double> servo_dir;
00159 ServoSerial* serial;
00160 };
00161
00162
00163 extern "C"
00164 {
00165 void ServoControllerInit(RTC::Manager* manager);
00166 };
00167
00168 #endif // SERVO_CONTROLLER_H