Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef ROBOT_STATUS_H
00033 #define ROBOT_STATUS_H
00034
00035 #ifdef ROS
00036 #include "simple_message/simple_message.h"
00037 #include "simple_message/simple_serialize.h"
00038 #include "simple_message/shared_types.h"
00039
00040 #endif
00041
00042 #ifdef MOTOPLUS
00043 #include "simple_message.h"
00044 #include "simple_serialize.h"
00045 #include "shared_types.h"
00046
00047 #endif
00048
00049 namespace industrial
00050 {
00051 namespace robot_status
00052 {
00053
00058 namespace RobotModes
00059 {
00060 enum RobotMode
00061 {
00062 UNKNOWN = -1,
00063
00064 MANUAL = 1, AUTO = 2,
00065 };
00066
00067 #ifdef ROS
00068 int toROSMsgEnum(RobotModes::RobotMode mode);
00069 #endif
00070
00071 }
00072 typedef RobotModes::RobotMode RobotMode;
00073
00080 namespace TriStates
00081 {
00082
00083 enum TriState
00084 {
00085 TS_UNKNOWN = -1,
00086
00087 TS_TRUE = 1, TS_ON = 1, TS_ENABLED = 1, TS_HIGH = 1,
00088
00089 TS_FALSE = 0, TS_OFF = 0, TS_DISABLED = 0, TS_LOW = 0
00090 };
00091
00092 #ifdef ROS
00093 int toROSMsgEnum(TriStates::TriState state);
00094 #endif
00095
00096 }
00097 typedef TriStates::TriState TriState;
00098
00120 class RobotStatus : public industrial::simple_serialize::SimpleSerialize
00121 {
00122 public:
00129 RobotStatus(void);
00134 ~RobotStatus(void);
00135
00140 void init();
00141
00146 void init(TriState drivesPowered, TriState eStopped, industrial::shared_types::shared_int errorCode, TriState inError,
00147 TriState inMotion, RobotMode mode, TriState motionPossible);
00148
00149 TriState getDrivesPowered()
00150 {
00151 return TriState(drives_powered_);
00152 }
00153
00154 TriState getEStopped()
00155 {
00156 return TriState(e_stopped_);
00157 }
00158
00159 industrial::shared_types::shared_int getErrorCode() const
00160 {
00161 return error_code_;
00162 }
00163
00164 TriState getInError()
00165 {
00166 return TriState(in_error_);
00167 }
00168
00169 TriState getInMotion()
00170 {
00171 return TriState(in_motion_);
00172 }
00173
00174 RobotMode getMode()
00175 {
00176 return RobotMode(mode_);
00177 }
00178
00179 TriState getMotionPossible()
00180 {
00181 return TriState(motion_possible_);
00182 }
00183
00184 void setDrivesPowered(TriState drivesPowered)
00185 {
00186 this->drives_powered_ = drivesPowered;
00187 }
00188
00189 void setEStopped(TriState eStopped)
00190 {
00191 this->e_stopped_ = eStopped;
00192 }
00193
00194 void setErrorCode(industrial::shared_types::shared_int errorCode)
00195 {
00196 this->error_code_ = errorCode;
00197 }
00198
00199 void setInError(TriState inError)
00200 {
00201 this->in_error_ = inError;
00202 }
00203
00204 void setInMotion(TriState inMotion)
00205 {
00206 this->in_motion_ = inMotion;
00207 }
00208
00209 void setMode(RobotMode mode)
00210 {
00211 this->mode_ = mode;
00212 }
00213
00214 void setMotionPossible(TriState motionPossible)
00215 {
00216 this->motion_possible_ = motionPossible;
00217 }
00218
00224 void copyFrom(RobotStatus &src);
00225
00231 bool operator==(RobotStatus &rhs);
00232
00233
00234 bool load(industrial::byte_array::ByteArray *buffer);
00235 bool unload(industrial::byte_array::ByteArray *buffer);
00236 unsigned int byteLength()
00237 {
00238 return 7 * sizeof(industrial::shared_types::shared_int);
00239 }
00240
00241 private:
00242
00246 industrial::shared_types::shared_int mode_;
00247
00251 industrial::shared_types::shared_int e_stopped_;
00252
00256 industrial::shared_types::shared_int drives_powered_;
00257
00261 industrial::shared_types::shared_int motion_possible_;
00262
00266 industrial::shared_types::shared_int in_motion_;
00267
00271 industrial::shared_types::shared_int in_error_;
00272
00276 industrial::shared_types::shared_int error_code_;
00277
00278 };
00279
00280 }
00281 }
00282
00283 #endif