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 // remove ROS after Melodic (bw compat for #262)
64 #if defined(SIMPLE_MESSAGE_USE_ROS) || defined(ROS)
65 int toROSMsgEnum(RobotModes::RobotMode mode);
66 #endif
67 
68 }
70 
77 namespace TriStates
78 {
79 
81 {
82  TS_UNKNOWN = -1,
83  // These values must all be the same
84  TS_TRUE = 1, TS_ON = 1, TS_ENABLED = 1, TS_HIGH = 1,
85  // These values must all be the same
86  TS_FALSE = 0, TS_OFF = 0, TS_DISABLED = 0, TS_LOW = 0
87 };
88 
89 // remove ROS after Melodic (bw compat for #262)
90 #if defined(SIMPLE_MESSAGE_USE_ROS) || defined(ROS)
91 int toROSMsgEnum(TriStates::TriState state);
92 #endif
93 
94 }
96 
119 {
120 public:
127 RobotStatus(void);
132 ~RobotStatus(void);
133 
138 void init();
139 
144 void init(TriState drivesPowered, TriState eStopped, industrial::shared_types::shared_int errorCode, TriState inError,
145  TriState inMotion, RobotMode mode, TriState motionPossible);
146 
148 {
149  return TriState(drives_powered_);
150 }
151 
152 TriState getEStopped()
153 {
154  return TriState(e_stopped_);
155 }
156 
158 {
159  return error_code_;
160 }
161 
162 TriState getInError()
163 {
164  return TriState(in_error_);
165 }
166 
167 TriState getInMotion()
168 {
169  return TriState(in_motion_);
170 }
171 
172 RobotMode getMode()
173 {
174  return RobotMode(mode_);
175 }
176 
178 {
179  return TriState(motion_possible_);
180 }
181 
182 void setDrivesPowered(TriState drivesPowered)
183 {
184  this->drives_powered_ = drivesPowered;
185 }
186 
187 void setEStopped(TriState eStopped)
188 {
189  this->e_stopped_ = eStopped;
190 }
191 
193 {
194  this->error_code_ = errorCode;
195 }
196 
197 void setInError(TriState inError)
198 {
199  this->in_error_ = inError;
200 }
201 
202 void setInMotion(TriState inMotion)
203 {
204  this->in_motion_ = inMotion;
205 }
206 
207 void setMode(RobotMode mode)
208 {
209  this->mode_ = mode;
210 }
211 
212 void setMotionPossible(TriState motionPossible)
213 {
214  this->motion_possible_ = motionPossible;
215 }
216 
222 void copyFrom(RobotStatus &src);
223 
229 bool operator==(RobotStatus &rhs);
230 
231 // Overrides - SimpleSerialize
232 bool load(industrial::byte_array::ByteArray *buffer);
233 bool unload(industrial::byte_array::ByteArray *buffer);
234 unsigned int byteLength()
235 {
236  return 7 * sizeof(industrial::shared_types::shared_int);
237 }
238 
239 private:
240 
245 
250 
255 
260 
265 
270 
275 
276 };
277 
278 }
279 }
280 
281 #endif /* JOINT_TRAJ_PT_H */
void setInError(TriState inError)
Definition: robot_status.h:197
industrial::shared_types::shared_int in_motion_
in motion state (see TriStates::TriState)
Definition: robot_status.h:264
industrial::shared_types::shared_int motion_possible_
motion possible state (see TriStates::TriState)
Definition: robot_status.h:259
void setMotionPossible(TriState motionPossible)
Definition: robot_status.h:212
industrial::shared_types::shared_int in_error_
in error state (see TriStates::TriState)
Definition: robot_status.h:269
void init(const M_string &remappings)
void setErrorCode(industrial::shared_types::shared_int errorCode)
Definition: robot_status.h:192
industrial::shared_types::shared_int mode_
Operating mode (see RobotModes::RobotMode)
Definition: robot_status.h:244
bool operator==(const in6_addr a, const in6_addr b)
Class encapsulated robot status data. The robot status data is meant to mirror the industrial_msgs/Ro...
Definition: robot_status.h:118
Interface for loading and unloading a class to/from a ByteArray.
void setInMotion(TriState inMotion)
Definition: robot_status.h:202
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:249
unsigned int byteLength()
Virtual method returns the object size when packed into a ByteArray.
Definition: robot_status.h:234
industrial::shared_types::shared_int getErrorCode() const
Definition: robot_status.h:157
void setDrivesPowered(TriState drivesPowered)
Definition: robot_status.h:182
void setEStopped(TriState eStopped)
Definition: robot_status.h:187
TriStates::TriState TriState
Definition: robot_status.h:95
industrial::shared_types::shared_int error_code_
error code (non-zero is error)
Definition: robot_status.h:274
industrial::shared_types::shared_int drives_powered_
Drive power state (see TriStates::TriState)
Definition: robot_status.h:254


simple_message
Author(s): Shaun Edwards
autogenerated on Mon Feb 28 2022 22:34:36