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 #ifndef FLATHEADERS
00036 #include "simple_message/simple_message.h"
00037 #include "simple_message/simple_serialize.h"
00038 #include "simple_message/shared_types.h"
00039 #else
00040 #include "simple_message.h"
00041 #include "simple_serialize.h"
00042 #include "shared_types.h"
00043 #endif
00044
00045 namespace industrial
00046 {
00047 namespace robot_status
00048 {
00049
00054 namespace RobotModes
00055 {
00056 enum RobotMode
00057 {
00058 UNKNOWN = -1,
00059
00060 MANUAL = 1, AUTO = 2,
00061 };
00062
00063 #ifdef ROS
00064 int toROSMsgEnum(RobotModes::RobotMode mode);
00065 #endif
00066
00067 }
00068 typedef RobotModes::RobotMode RobotMode;
00069
00076 namespace TriStates
00077 {
00078
00079 enum TriState
00080 {
00081 TS_UNKNOWN = -1,
00082
00083 TS_TRUE = 1, TS_ON = 1, TS_ENABLED = 1, TS_HIGH = 1,
00084
00085 TS_FALSE = 0, TS_OFF = 0, TS_DISABLED = 0, TS_LOW = 0
00086 };
00087
00088 #ifdef ROS
00089 int toROSMsgEnum(TriStates::TriState state);
00090 #endif
00091
00092 }
00093 typedef TriStates::TriState TriState;
00094
00116 class RobotStatus : public industrial::simple_serialize::SimpleSerialize
00117 {
00118 public:
00125 RobotStatus(void);
00130 ~RobotStatus(void);
00131
00136 void init();
00137
00142 void init(TriState drivesPowered, TriState eStopped, industrial::shared_types::shared_int errorCode, TriState inError,
00143 TriState inMotion, RobotMode mode, TriState motionPossible);
00144
00145 TriState getDrivesPowered()
00146 {
00147 return TriState(drives_powered_);
00148 }
00149
00150 TriState getEStopped()
00151 {
00152 return TriState(e_stopped_);
00153 }
00154
00155 industrial::shared_types::shared_int getErrorCode() const
00156 {
00157 return error_code_;
00158 }
00159
00160 TriState getInError()
00161 {
00162 return TriState(in_error_);
00163 }
00164
00165 TriState getInMotion()
00166 {
00167 return TriState(in_motion_);
00168 }
00169
00170 RobotMode getMode()
00171 {
00172 return RobotMode(mode_);
00173 }
00174
00175 TriState getMotionPossible()
00176 {
00177 return TriState(motion_possible_);
00178 }
00179
00180 void setDrivesPowered(TriState drivesPowered)
00181 {
00182 this->drives_powered_ = drivesPowered;
00183 }
00184
00185 void setEStopped(TriState eStopped)
00186 {
00187 this->e_stopped_ = eStopped;
00188 }
00189
00190 void setErrorCode(industrial::shared_types::shared_int errorCode)
00191 {
00192 this->error_code_ = errorCode;
00193 }
00194
00195 void setInError(TriState inError)
00196 {
00197 this->in_error_ = inError;
00198 }
00199
00200 void setInMotion(TriState inMotion)
00201 {
00202 this->in_motion_ = inMotion;
00203 }
00204
00205 void setMode(RobotMode mode)
00206 {
00207 this->mode_ = mode;
00208 }
00209
00210 void setMotionPossible(TriState motionPossible)
00211 {
00212 this->motion_possible_ = motionPossible;
00213 }
00214
00220 void copyFrom(RobotStatus &src);
00221
00227 bool operator==(RobotStatus &rhs);
00228
00229
00230 bool load(industrial::byte_array::ByteArray *buffer);
00231 bool unload(industrial::byte_array::ByteArray *buffer);
00232 unsigned int byteLength()
00233 {
00234 return 7 * sizeof(industrial::shared_types::shared_int);
00235 }
00236
00237 private:
00238
00242 industrial::shared_types::shared_int mode_;
00243
00247 industrial::shared_types::shared_int e_stopped_;
00248
00252 industrial::shared_types::shared_int drives_powered_;
00253
00257 industrial::shared_types::shared_int motion_possible_;
00258
00262 industrial::shared_types::shared_int in_motion_;
00263
00267 industrial::shared_types::shared_int in_error_;
00268
00272 industrial::shared_types::shared_int error_code_;
00273
00274 };
00275
00276 }
00277 }
00278
00279 #endif