KatanaInterface.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __INTERFACES_KATANAINTERFACE_H_
00025 #define __INTERFACES_KATANAINTERFACE_H_
00026
00027 #include <interface/interface.h>
00028 #include <interface/message.h>
00029 #include <interface/field_iterator.h>
00030
00031 namespace fawkes {
00032
00033 class KatanaInterface : public Interface
00034 {
00035
00036 INTERFACE_MGMT_FRIENDS(KatanaInterface)
00037
00038 public:
00039
00040 static const uint32_t SENSOR_IR_RIGHT_INNER_MIDDLE;
00041 static const uint32_t SENSOR_IR_RIGHT_INNER_FRONT;
00042 static const uint32_t SENSOR_RESERVED_2;
00043 static const uint32_t SENSOR_COND_BOTH;
00044 static const uint32_t SENSOR_IR_RIGHT_OUTER_FRONT;
00045 static const uint32_t SENSOR_IR_RIGHT_BOTTOM_FRONT;
00046 static const uint32_t SENSOR_FORCE_RIGHT_REAR;
00047 static const uint32_t SENSOR_FORCE_RIGHT_FRONT;
00048 static const uint32_t SENSOR_IR_LEFT_INNER_MIDDLE;
00049 static const uint32_t SENSOR_IR_LEFT_INNER_FRONT;
00050 static const uint32_t SENSOR_RESERVED_10;
00051 static const uint32_t SENSOR_IR_CENTER_GRIPPER;
00052 static const uint32_t SENSOR_IR_LEFT_OUTER_FRONT;
00053 static const uint32_t SENSOR_IR_LEFT_BOTTOM_FRONT;
00054 static const uint32_t SENSOR_FORCE_LEFT_REAR;
00055 static const uint32_t SENSOR_FORCE_LEFT_FRONT;
00056 static const uint32_t ERROR_NONE;
00057 static const uint32_t ERROR_UNSPECIFIC;
00058 static const uint32_t ERROR_CMD_START_FAILED;
00059 static const uint32_t ERROR_NO_SOLUTION;
00060 static const uint32_t ERROR_COMMUNICATION;
00061 static const uint32_t ERROR_MOTOR_CRASHED;
00062
00063 private:
00064 #pragma pack(push,4)
00065
00066 typedef struct {
00067 int64_t timestamp_sec;
00068 int64_t timestamp_usec;
00069 uint8_t sensor_value[16];
00070
00071 float x;
00072
00073 float y;
00074
00075 float z;
00076
00077 float phi;
00078 float theta;
00079 float psi;
00080 uint32_t msgid;
00081
00082 bool final;
00083
00084 uint32_t error_code;
00085
00086
00087 bool enabled;
00088 bool calibrated;
00089 uint8_t max_velocity;
00090 uint8_t num_motors;
00091 } KatanaInterface_data_t;
00092 #pragma pack(pop)
00093
00094 KatanaInterface_data_t *data;
00095
00096 public:
00097
00098 class StopMessage : public Message
00099 {
00100 private:
00101 #pragma pack(push,4)
00102
00103 typedef struct {
00104 int64_t timestamp_sec;
00105 int64_t timestamp_usec;
00106 } StopMessage_data_t;
00107 #pragma pack(pop)
00108
00109 StopMessage_data_t *data;
00110
00111 public:
00112 StopMessage();
00113 ~StopMessage();
00114
00115 StopMessage(const StopMessage *m);
00116
00117 virtual Message * clone() const;
00118 };
00119
00120 class FlushMessage : public Message
00121 {
00122 private:
00123 #pragma pack(push,4)
00124
00125 typedef struct {
00126 int64_t timestamp_sec;
00127 int64_t timestamp_usec;
00128 } FlushMessage_data_t;
00129 #pragma pack(pop)
00130
00131 FlushMessage_data_t *data;
00132
00133 public:
00134 FlushMessage();
00135 ~FlushMessage();
00136
00137 FlushMessage(const FlushMessage *m);
00138
00139 virtual Message * clone() const;
00140 };
00141
00142 class ParkMessage : public Message
00143 {
00144 private:
00145 #pragma pack(push,4)
00146
00147 typedef struct {
00148 int64_t timestamp_sec;
00149 int64_t timestamp_usec;
00150 } ParkMessage_data_t;
00151 #pragma pack(pop)
00152
00153 ParkMessage_data_t *data;
00154
00155 public:
00156 ParkMessage();
00157 ~ParkMessage();
00158
00159 ParkMessage(const ParkMessage *m);
00160
00161 virtual Message * clone() const;
00162 };
00163
00164 class LinearGotoMessage : public Message
00165 {
00166 private:
00167 #pragma pack(push,4)
00168
00169 typedef struct {
00170 int64_t timestamp_sec;
00171 int64_t timestamp_usec;
00172 float x;
00173
00174 float y;
00175
00176 float z;
00177
00178 float phi;
00179 float theta;
00180 float psi;
00181 } LinearGotoMessage_data_t;
00182 #pragma pack(pop)
00183
00184 LinearGotoMessage_data_t *data;
00185
00186 public:
00187 LinearGotoMessage(const float ini_x, const float ini_y, const float ini_z, const float ini_phi, const float ini_theta, const float ini_psi);
00188 LinearGotoMessage();
00189 ~LinearGotoMessage();
00190
00191 LinearGotoMessage(const LinearGotoMessage *m);
00192
00193 float x() const;
00194 void set_x(const float new_x);
00195 size_t maxlenof_x() const;
00196 float y() const;
00197 void set_y(const float new_y);
00198 size_t maxlenof_y() const;
00199 float z() const;
00200 void set_z(const float new_z);
00201 size_t maxlenof_z() const;
00202 float phi() const;
00203 void set_phi(const float new_phi);
00204 size_t maxlenof_phi() const;
00205 float theta() const;
00206 void set_theta(const float new_theta);
00207 size_t maxlenof_theta() const;
00208 float psi() const;
00209 void set_psi(const float new_psi);
00210 size_t maxlenof_psi() const;
00211 virtual Message * clone() const;
00212 };
00213
00214 class CalibrateMessage : public Message
00215 {
00216 private:
00217 #pragma pack(push,4)
00218
00219 typedef struct {
00220 int64_t timestamp_sec;
00221 int64_t timestamp_usec;
00222 } CalibrateMessage_data_t;
00223 #pragma pack(pop)
00224
00225 CalibrateMessage_data_t *data;
00226
00227 public:
00228 CalibrateMessage();
00229 ~CalibrateMessage();
00230
00231 CalibrateMessage(const CalibrateMessage *m);
00232
00233 virtual Message * clone() const;
00234 };
00235
00236 class OpenGripperMessage : public Message
00237 {
00238 private:
00239 #pragma pack(push,4)
00240
00241 typedef struct {
00242 int64_t timestamp_sec;
00243 int64_t timestamp_usec;
00244 } OpenGripperMessage_data_t;
00245 #pragma pack(pop)
00246
00247 OpenGripperMessage_data_t *data;
00248
00249 public:
00250 OpenGripperMessage();
00251 ~OpenGripperMessage();
00252
00253 OpenGripperMessage(const OpenGripperMessage *m);
00254
00255 virtual Message * clone() const;
00256 };
00257
00258 class CloseGripperMessage : public Message
00259 {
00260 private:
00261 #pragma pack(push,4)
00262
00263 typedef struct {
00264 int64_t timestamp_sec;
00265 int64_t timestamp_usec;
00266 } CloseGripperMessage_data_t;
00267 #pragma pack(pop)
00268
00269 CloseGripperMessage_data_t *data;
00270
00271 public:
00272 CloseGripperMessage();
00273 ~CloseGripperMessage();
00274
00275 CloseGripperMessage(const CloseGripperMessage *m);
00276
00277 virtual Message * clone() const;
00278 };
00279
00280 class SetEnabledMessage : public Message
00281 {
00282 private:
00283 #pragma pack(push,4)
00284
00285 typedef struct {
00286 int64_t timestamp_sec;
00287 int64_t timestamp_usec;
00288 bool enabled;
00289 } SetEnabledMessage_data_t;
00290 #pragma pack(pop)
00291
00292 SetEnabledMessage_data_t *data;
00293
00294 public:
00295 SetEnabledMessage(const bool ini_enabled);
00296 SetEnabledMessage();
00297 ~SetEnabledMessage();
00298
00299 SetEnabledMessage(const SetEnabledMessage *m);
00300
00301 bool is_enabled() const;
00302 void set_enabled(const bool new_enabled);
00303 size_t maxlenof_enabled() const;
00304 virtual Message * clone() const;
00305 };
00306
00307 class SetMaxVelocityMessage : public Message
00308 {
00309 private:
00310 #pragma pack(push,4)
00311
00312 typedef struct {
00313 int64_t timestamp_sec;
00314 int64_t timestamp_usec;
00315 uint8_t max_velocity;
00316 } SetMaxVelocityMessage_data_t;
00317 #pragma pack(pop)
00318
00319 SetMaxVelocityMessage_data_t *data;
00320
00321 public:
00322 SetMaxVelocityMessage(const uint8_t ini_max_velocity);
00323 SetMaxVelocityMessage();
00324 ~SetMaxVelocityMessage();
00325
00326 SetMaxVelocityMessage(const SetMaxVelocityMessage *m);
00327
00328 uint8_t max_velocity() const;
00329 void set_max_velocity(const uint8_t new_max_velocity);
00330 size_t maxlenof_max_velocity() const;
00331 virtual Message * clone() const;
00332 };
00333
00334 virtual bool message_valid(const Message *message) const;
00335 private:
00336 KatanaInterface();
00337 ~KatanaInterface();
00338
00339 public:
00340
00341 uint8_t * sensor_value() const;
00342 uint8_t sensor_value(unsigned int index) const;
00343 void set_sensor_value(unsigned int index, const uint8_t new_sensor_value);
00344 void set_sensor_value(const uint8_t * new_sensor_value);
00345 size_t maxlenof_sensor_value() const;
00346 float x() const;
00347 void set_x(const float new_x);
00348 size_t maxlenof_x() const;
00349 float y() const;
00350 void set_y(const float new_y);
00351 size_t maxlenof_y() const;
00352 float z() const;
00353 void set_z(const float new_z);
00354 size_t maxlenof_z() const;
00355 float phi() const;
00356 void set_phi(const float new_phi);
00357 size_t maxlenof_phi() const;
00358 float theta() const;
00359 void set_theta(const float new_theta);
00360 size_t maxlenof_theta() const;
00361 float psi() const;
00362 void set_psi(const float new_psi);
00363 size_t maxlenof_psi() const;
00364 uint32_t msgid() const;
00365 void set_msgid(const uint32_t new_msgid);
00366 size_t maxlenof_msgid() const;
00367 bool is_final() const;
00368 void set_final(const bool new_final);
00369 size_t maxlenof_final() const;
00370 uint32_t error_code() const;
00371 void set_error_code(const uint32_t new_error_code);
00372 size_t maxlenof_error_code() const;
00373 bool is_enabled() const;
00374 void set_enabled(const bool new_enabled);
00375 size_t maxlenof_enabled() const;
00376 bool is_calibrated() const;
00377 void set_calibrated(const bool new_calibrated);
00378 size_t maxlenof_calibrated() const;
00379 uint8_t max_velocity() const;
00380 void set_max_velocity(const uint8_t new_max_velocity);
00381 size_t maxlenof_max_velocity() const;
00382 uint8_t num_motors() const;
00383 void set_num_motors(const uint8_t new_num_motors);
00384 size_t maxlenof_num_motors() const;
00385 virtual Message * create_message(const char *type) const;
00386
00387 virtual void copy_values(const Interface *other);
00388 virtual const char * enum_tostring(const char *enumtype, int val) const;
00389
00390 };
00391
00392 }
00393
00394 #endif