robot_status.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, Southwest Research Institute
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  * * Neither the name of the Southwest Research Institute, nor the names
16  * of its contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef ROBOT_STATUS_H
33 #define ROBOT_STATUS_H
34 
35 #ifndef FLATHEADERS
39 #else
40 #include "simple_message.h"
41 #include "simple_serialize.h"
42 #include "shared_types.h"
43 #endif
44 
45 namespace industrial
46 {
47 namespace robot_status
48 {
49 
54 namespace RobotModes
55 {
57 {
58  UNKNOWN = -1,
59 
60  MANUAL = 1, AUTO = 2,
61 };
62 
63 #ifdef ROS
64 int toROSMsgEnum(RobotModes::RobotMode mode);
65 #endif
66 
67 }
69 
76 namespace TriStates
77 {
78 
80 {
81  TS_UNKNOWN = -1,
82  // These values must all be the same
83  TS_TRUE = 1, TS_ON = 1, TS_ENABLED = 1, TS_HIGH = 1,
84  // These values must all be the same
85  TS_FALSE = 0, TS_OFF = 0, TS_DISABLED = 0, TS_LOW = 0
86 };
87 
88 #ifdef ROS
89 int toROSMsgEnum(TriStates::TriState state);
90 #endif
91 
92 }
94 
117 {
118 public:
125 RobotStatus(void);
130 ~RobotStatus(void);
131 
136 void init();
137 
142 void init(TriState drivesPowered, TriState eStopped, industrial::shared_types::shared_int errorCode, TriState inError,
143  TriState inMotion, RobotMode mode, TriState motionPossible);
144 
146 {
147  return TriState(drives_powered_);
148 }
149 
150 TriState getEStopped()
151 {
152  return TriState(e_stopped_);
153 }
154 
156 {
157  return error_code_;
158 }
159 
160 TriState getInError()
161 {
162  return TriState(in_error_);
163 }
164 
165 TriState getInMotion()
166 {
167  return TriState(in_motion_);
168 }
169 
170 RobotMode getMode()
171 {
172  return RobotMode(mode_);
173 }
174 
176 {
177  return TriState(motion_possible_);
178 }
179 
180 void setDrivesPowered(TriState drivesPowered)
181 {
182  this->drives_powered_ = drivesPowered;
183 }
184 
185 void setEStopped(TriState eStopped)
186 {
187  this->e_stopped_ = eStopped;
188 }
189 
191 {
192  this->error_code_ = errorCode;
193 }
194 
195 void setInError(TriState inError)
196 {
197  this->in_error_ = inError;
198 }
199 
200 void setInMotion(TriState inMotion)
201 {
202  this->in_motion_ = inMotion;
203 }
204 
205 void setMode(RobotMode mode)
206 {
207  this->mode_ = mode;
208 }
209 
210 void setMotionPossible(TriState motionPossible)
211 {
212  this->motion_possible_ = motionPossible;
213 }
214 
220 void copyFrom(RobotStatus &src);
221 
227 bool operator==(RobotStatus &rhs);
228 
229 // Overrides - SimpleSerialize
230 bool load(industrial::byte_array::ByteArray *buffer);
231 bool unload(industrial::byte_array::ByteArray *buffer);
232 unsigned int byteLength()
233 {
234  return 7 * sizeof(industrial::shared_types::shared_int);
235 }
236 
237 private:
238 
243 
248 
253 
258 
263 
268 
273 
274 };
275 
276 }
277 }
278 
279 #endif /* JOINT_TRAJ_PT_H */
void setInError(TriState inError)
Definition: robot_status.h:195
industrial::shared_types::shared_int in_motion_
in motion state (see TriStates::TriState)
Definition: robot_status.h:262
industrial::shared_types::shared_int motion_possible_
motion possible state (see TriStates::TriState)
Definition: robot_status.h:257
void setMotionPossible(TriState motionPossible)
Definition: robot_status.h:210
industrial::shared_types::shared_int in_error_
in error state (see TriStates::TriState)
Definition: robot_status.h:267
void init(const M_string &remappings)
void setErrorCode(industrial::shared_types::shared_int errorCode)
Definition: robot_status.h:190
industrial::shared_types::shared_int mode_
Operating mode (see RobotModes::RobotMode)
Definition: robot_status.h:242
Class encapsulated robot status data. The robot status data is meant to mirror the industrial_msgs/Ro...
Definition: robot_status.h:116
Interface for loading and unloading a class to/from a ByteArray.
void setInMotion(TriState inMotion)
Definition: robot_status.h:200
The byte array wraps a dynamic array of bytes (i.e. char).
Definition: byte_array.h:80
industrial::shared_types::shared_int e_stopped_
E-stop state (see TriStates::TriState)
Definition: robot_status.h:247
unsigned int byteLength()
Virtual method returns the object size when packed into a ByteArray.
Definition: robot_status.h:232
industrial::shared_types::shared_int getErrorCode() const
Definition: robot_status.h:155
void setDrivesPowered(TriState drivesPowered)
Definition: robot_status.h:180
void setEStopped(TriState eStopped)
Definition: robot_status.h:185
TriStates::TriState TriState
Definition: robot_status.h:93
industrial::shared_types::shared_int error_code_
error code (non-zero is error)
Definition: robot_status.h:272
industrial::shared_types::shared_int drives_powered_
Drive power state (see TriStates::TriState)
Definition: robot_status.h:252


simple_message
Author(s): Shaun Edwards
autogenerated on Sat Sep 21 2019 03:30:09