ServoController.h
Go to the documentation of this file.
1 // -*- C++ -*-
10 #ifndef SERVO_CONTROLLER_H
11 #define SERVO_CONTROLLER_H
12 
13 #include <rtm/idl/BasicDataType.hh>
14 #include <rtm/idl/ExtendedDataTypes.hh>
15 #include <rtm/Manager.h>
16 #include <rtm/DataFlowComponentBase.h>
17 #include <rtm/CorbaPort.h>
18 #include <rtm/DataInPort.h>
19 #include <rtm/DataOutPort.h>
20 #include <rtm/idl/BasicDataTypeSkel.h>
21 #include <rtm/idl/ExtendedDataTypesSkel.h>
22 
23 // Service implementation headers
24 // <rtc-template block="service_impl_h">
26 
27 // </rtc-template>
28 
29 // Service Consumer stub headers
30 // <rtc-template block="consumer_stub_h">
31 
32 // </rtc-template>
33 
34 using namespace RTC;
35 
36 class ServoSerial;
37 
43 {
44  public:
53  virtual ~ServoController();
54 
55  // The initialize action (on CREATED->ALIVE transition)
56  // formaer rtc_init_entry()
57  virtual RTC::ReturnCode_t onInitialize();
58 
59  // The finalize action (on ALIVE->END transition)
60  // formaer rtc_exiting_entry()
61  virtual RTC::ReturnCode_t onFinalize();
62 
63  // The startup action when ExecutionContext startup
64  // former rtc_starting_entry()
65  // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
66 
67  // The shutdown action when ExecutionContext stop
68  // former rtc_stopping_entry()
69  // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
70 
71  // The activated action (Active state entry action)
72  // former rtc_active_entry()
73  virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
74 
75  // The deactivated action (Active state exit action)
76  // former rtc_active_exit()
77  virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
78 
79  // The execution action that is invoked periodically
80  // former rtc_active_do()
81  virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
82 
83  // The aborting action when main logic error occurred.
84  // former rtc_aborting_entry()
85  // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
86 
87  // The error action in ERROR state
88  // former rtc_error_do()
89  // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
90 
91  // The reset action that is invoked resetting
92  // This is same but different the former rtc_init_entry()
93  // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
94 
95  // The state update action that is invoked after onExecute() action
96  // no corresponding operation exists in OpenRTm-aist-0.2.0
97  // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
98 
99  // The action that is invoked when execution context's rate is changed
100  // no corresponding operation exists in OpenRTm-aist-0.2.0
101  // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
102 
103  bool setJointAngle(short id, double angle, double tm);
104  bool setJointAngles(const OpenHRP::ServoControllerService::dSequence angles, double tm);
105  bool getJointAngle(short id, double &angle);
106  bool getJointAngles(OpenHRP::ServoControllerService::dSequence_out &angles);
107  bool addJointGroup(const char *gname, const ::OpenHRP::ServoControllerService::iSequence ids);
108  bool removeJointGroup(const char *gname);
109  bool setJointAnglesOfGroup(const char *gname, const ::OpenHRP::ServoControllerService::dSequence angles, double tm);
110  bool setMaxTorque(short id, short percentage);
111  bool setReset(short id);
112  bool getDuration(short id, double &duration);
113  bool getSpeed(short id, double &speed);
114  bool getMaxTorque(short id, short &percentage);
115  bool getTorque(short id, double &torque);
116  bool getTemperature(short id, double &temperature);
117  bool getVoltage(short id, double &voltage);
118  bool servoOn();
119  bool servoOff();
120 
121  protected:
122  // Configuration variable declaration
123  // <rtc-template block="config_declare">
124 
125  // </rtc-template>
126 
127  // DataInPort declaration
128  // <rtc-template block="inport_declare">
129 
130  // </rtc-template>
131 
132  // DataOutPort declaration
133  // <rtc-template block="outport_declare">
134 
135  // </rtc-template>
136 
137  // CORBA Port declaration
138  // <rtc-template block="corbaport_declare">
139 
140  // </rtc-template>
141 
142  // Service declaration
143  // <rtc-template block="service_declare">
145 
146  // </rtc-template>
147 
148  // Consumer declaration
149  // <rtc-template block="consumer_declare">
151 
152  // </rtc-template>
153 
154  private:
155  std::map<std::string, std::vector<int> > joint_groups;
156  std::vector<int> servo_id;
157  std::vector<double> servo_offset;
158  std::vector<double> servo_dir;
160 };
161 
162 
163 extern "C"
164 {
166 };
167 
168 #endif // SERVO_CONTROLLER_H
ec_id
std::vector< int > servo_id
def servoOn(joint="all")
Definition: PA10.py:77
manager
std::vector< double > servo_dir
std::vector< double > servo_offset
int temperature(int s)
void ServoControllerInit(RTC::Manager *manager)
ServoControllerService_impl m_service0
std::map< std::string, std::vector< int > > joint_groups
RTC::CorbaPort m_ServoControllerServicePort
ExecutionContextHandle_t UniqueId
def servoOff(joint="all")
Definition: PA10.py:86
ServoSerial * serial
sample RT component which has one data input port and one data output port


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:51