control_mode.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 2021 FZI Forschungszentrum Informatik
5 // Created on behalf of Universal Robots A/S
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 //----------------------------------------------------------------------
27 //----------------------------------------------------------------------
28 
29 #ifndef UR_CLIENT_LIBRARY_CONTROL_MODE_H_INCLUDED
30 #define UR_CLIENT_LIBRARY_CONTROL_MODE_H_INCLUDED
31 
32 #include <algorithm>
33 #include <vector>
34 
35 namespace urcl
36 {
37 namespace comm
38 {
42 enum class ControlMode : int32_t
43 {
44  MODE_STOPPED = -2,
45  MODE_UNINITIALIZED = -1,
46  MODE_IDLE = 0,
47  MODE_SERVOJ = 1,
48  MODE_SPEEDJ = 2,
49  MODE_FORWARD = 3,
50  MODE_SPEEDL = 4,
51  MODE_POSE = 5,
52  MODE_FREEDRIVE = 6,
54  7,
55  END
56 };
57 
62 {
63 public:
64  // Control modes that require realtime communication
65  static const inline std::vector<ControlMode> REALTIME_CONTROL_MODES = {
67  };
68 
69  // Control modes that doesn't require realtime communication
70  static const inline std::vector<ControlMode> NON_REALTIME_CONTROL_MODES = { ControlMode::MODE_IDLE,
73 
74  // Control modes which doesn't move the robot, meaning they are neither realtime or non realtime
75  static const inline std::vector<ControlMode> STATIONARY_CONTROL_MODES = { ControlMode::MODE_STOPPED,
78 
86  static bool isControlModeRealtime(ControlMode control_mode)
87  {
89  control_mode) != ControlModeTypes::REALTIME_CONTROL_MODES.end());
90  }
91 
99  static bool isControlModeNonRealtime(ControlMode control_mode)
100  {
101  return (std::find(ControlModeTypes::NON_REALTIME_CONTROL_MODES.begin(),
103  control_mode) != ControlModeTypes::NON_REALTIME_CONTROL_MODES.end());
104  }
105 };
106 
107 } // namespace comm
108 } // namespace urcl
109 
110 #endif // ifndef UR_CLIENT_LIBRARY_CONTROL_MODE_H_INCLUDED
urcl::comm::ControlMode
ControlMode
Control modes as interpreted from the script runnning on the robot.
Definition: control_mode.h:42
urcl::comm::ControlModeTypes
Class used to separate the control modes into realtime and non realtime.
Definition: control_mode.h:61
urcl::comm::ControlMode::MODE_FORWARD
@ MODE_FORWARD
Set when trajectory forwarding is active.
urcl::comm::ControlMode::MODE_SPEEDJ
@ MODE_SPEEDJ
Set when speedj control is active.
urcl
Definition: bin_parser.h:36
urcl::comm::ControlMode::MODE_FREEDRIVE
@ MODE_FREEDRIVE
Set when freedrive mode is active.
urcl::comm::ControlMode::MODE_IDLE
@ MODE_IDLE
Set when no controller is currently active controlling the robot.
urcl::comm::ControlModeTypes::isControlModeRealtime
static bool isControlModeRealtime(ControlMode control_mode)
Check if the control mode is realtime.
Definition: control_mode.h:86
urcl::comm::ControlMode::MODE_SPEEDL
@ MODE_SPEEDL
Set when cartesian velocity control is active.
urcl::comm::ControlModeTypes::STATIONARY_CONTROL_MODES
static const std::vector< ControlMode > STATIONARY_CONTROL_MODES
Definition: control_mode.h:75
urcl::comm::ControlMode::MODE_SERVOJ
@ MODE_SERVOJ
Set when servoj control is active.
urcl::comm::ControlModeTypes::REALTIME_CONTROL_MODES
static const std::vector< ControlMode > REALTIME_CONTROL_MODES
Definition: control_mode.h:65
urcl::comm::ControlMode::MODE_POSE
@ MODE_POSE
Set when cartesian pose control is active.
urcl::comm::ControlMode::END
@ END
This is not an actual control mode, but used internally to get the number of control modes.
urcl::comm::ControlMode::MODE_STOPPED
@ MODE_STOPPED
When this is set, the program is expected to stop and exit.
urcl::comm::ControlMode::MODE_UNINITIALIZED
@ MODE_UNINITIALIZED
Startup default until another mode is sent to the script.
urcl::comm::ControlModeTypes::isControlModeNonRealtime
static bool isControlModeNonRealtime(ControlMode control_mode)
Check if the control mode is non realtime.
Definition: control_mode.h:99
urcl::comm::ControlMode::MODE_TOOL_IN_CONTACT
@ MODE_TOOL_IN_CONTACT
Used only internally in the script, when robot is in tool contact, clear by endToolContact()
urcl::comm::ControlModeTypes::NON_REALTIME_CONTROL_MODES
static const std::vector< ControlMode > NON_REALTIME_CONTROL_MODES
Definition: control_mode.h:70


ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Mon May 26 2025 02:35:58