datatypes.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // Copyright 2019 FZI Forschungszentrum Informatik
5 // Copyright 2015, 2016 Thomas Timm Andersen (original version)
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 // -- END LICENSE BLOCK ------------------------------------------------
19 
20 //----------------------------------------------------------------------
28 //----------------------------------------------------------------------
29 
31 
32 namespace urcl
33 {
34 enum class RobotMode : int8_t
35 {
36  UNKNOWN = -128, // This is not defined by UR but only inside this driver
37  NO_CONTROLLER = -1,
38  DISCONNECTED = 0,
39  CONFIRM_SAFETY = 1,
40  BOOTING = 2,
41  POWER_OFF = 3,
42  POWER_ON = 4,
43  IDLE = 5,
44  BACKDRIVE = 6,
45  RUNNING = 7,
47 };
48 
49 enum class SafetyMode : int8_t
50 {
51  NORMAL = 1,
52  REDUCED = 2,
53  PROTECTIVE_STOP = 3,
54  RECOVERY = 4,
55  SAFEGUARD_STOP = 5,
58  VIOLATION = 8,
59  FAULT = 9,
60  VALIDATE_JOINT_ID = 10,
62 };
63 
64 enum class SafetyStatus : int8_t // Only available on 3.10/5.4
65 {
66  NORMAL = 1,
67  REDUCED = 2,
68  PROTECTIVE_STOP = 3,
69  RECOVERY = 4,
70  SAFEGUARD_STOP = 5,
73  VIOLATION = 8,
74  FAULT = 9,
75  VALIDATE_JOINT_ID = 10,
79 };
80 
81 inline std::string robotModeString(const RobotMode& mode)
82 {
83  switch (mode)
84  {
86  return "NO_CONTROLLER";
88  return "DISCONNECTED";
90  return "CONFIRM_SAFETY";
91  case RobotMode::BOOTING:
92  return "BOOTING";
94  return "POWER_OFF";
96  return "POWER_ON";
97  case RobotMode::IDLE:
98  return "IDLE";
100  return "BACKDRIVE";
101  case RobotMode::RUNNING:
102  return "RUNNING";
104  return "UPDATING_FIRMWARE";
105  default:
106  std::stringstream ss;
107  ss << "Unknown robot mode: " << static_cast<int>(mode);
108  throw std::invalid_argument(ss.str());
109  }
110 }
111 
112 inline std::string safetyModeString(const SafetyMode& mode)
113 {
114  switch (mode)
115  {
116  case SafetyMode::NORMAL:
117  return "NORMAL";
118  case SafetyMode::REDUCED:
119  return "REDUCED";
121  return "PROTECTIVE_STOP";
123  return "RECOVERY";
125  return "SAFEGUARD_STOP";
127  return "SYSTEM_EMERGENCY_STOP";
129  return "ROBOT_EMERGENCY_STOP";
131  return "VIOLATION";
132  case SafetyMode::FAULT:
133  return "FAULT";
135  return "VALIDATE_JOINT_ID";
137  return "UNDEFINED_SAFETY_MODE";
138  default:
139  std::stringstream ss;
140  ss << "Unknown safety mode: " << static_cast<int>(mode);
141  throw std::invalid_argument(ss.str());
142  }
143 }
144 
145 inline std::string safetyStatusString(const SafetyStatus& status)
146 {
147  switch (status)
148  {
150  return "NORMAL";
152  return "REDUCED";
154  return "PROTECTIVE_STOP";
156  return "RECOVERY";
158  return "SAFEGUARD_STOP";
160  return "SYSTEM_EMERGENCY_STOP";
162  return "ROBOT_EMERGENCY_STOP";
164  return "VIOLATION";
165  case SafetyStatus::FAULT:
166  return "FAULT";
168  return "VALIDATE_JOINT_ID";
170  return "UNDEFINED_SAFETY_MODE";
172  return "AUTOMATIC_MODE_SAFEGUARD_STOP";
174  return "SYSTEM_THREE_POSITION_ENABLING_STOP";
175  default:
176  std::stringstream ss;
177  ss << "Unknown safety status: " << static_cast<int>(status);
178  throw std::invalid_argument(ss.str());
179  }
180 }
181 } // namespace urcl
RobotMode
Definition: datatypes.h:34
std::string safetyStatusString(const SafetyStatus &status)
Definition: datatypes.h:145
std::string robotModeString(const RobotMode &mode)
Definition: datatypes.h:81
SafetyStatus
Definition: datatypes.h:64
SafetyMode
Definition: datatypes.h:49
std::string safetyModeString(const SafetyMode &mode)
Definition: datatypes.h:112


ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Sun May 9 2021 02:16:26