rtde_client.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 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 // -- END LICENSE BLOCK ------------------------------------------------
18 
19 //----------------------------------------------------------------------
26 //----------------------------------------------------------------------
27 
28 #ifndef UR_CLIENT_LIBRARY_RTDE_CLIENT_H_INCLUDED
29 #define UR_CLIENT_LIBRARY_RTDE_CLIENT_H_INCLUDED
30 
41 #include "ur_client_library/log.h"
43 
44 static const int UR_RTDE_PORT = 30004;
45 static const std::string PIPELINE_NAME = "RTDE Data Pipeline";
46 
47 namespace urcl
48 {
49 namespace rtde_interface
50 {
51 static const uint16_t MAX_RTDE_PROTOCOL_VERSION = 2;
52 static const unsigned MAX_REQUEST_RETRIES = 5;
53 
55 {
56  IS_POWER_ON = 0,
60 };
61 
63 {
64  IS_NORMAL_MODE = 0,
65  IS_REDUCED_MODE = 1,
67  IS_RECOVERY_MODE = 3,
72  IS_VIOLATION = 8,
73  IS_FAULT = 9,
75 };
76 
82 {
83 public:
84  RTDEClient() = delete;
94  RTDEClient(std::string robot_ip, comm::INotifier& notifier, const std::string& output_recipe_file,
95  const std::string& input_recipe_file);
96  ~RTDEClient();
103  bool init();
109  bool start();
117  std::unique_ptr<rtde_interface::DataPackage> getDataPackage(std::chrono::milliseconds timeout);
118 
124  double getMaxFrequency() const
125  {
126  return max_frequency_;
127  }
128 
135  {
136  return urcontrol_version_;
137  }
138 
144  std::string getIP() const;
145 
152  RTDEWriter& getWriter();
153 
159  std::vector<std::string> getOutputRecipe()
160  {
161  return output_recipe_;
162  }
163 
164 private:
166  std::vector<std::string> output_recipe_;
167  std::vector<std::string> input_recipe_;
172 
174 
176 
177  constexpr static const double CB3_MAX_FREQUENCY = 125.0;
178  constexpr static const double URE_MAX_FREQUENCY = 500.0;
179 
180  std::vector<std::string> readRecipe(const std::string& recipe_file);
181 
182  bool negotiateProtocolVersion(const uint16_t protocol_version);
183  void queryURControlVersion();
184  void setupOutputs(const uint16_t protocol_version);
185  void setupInputs();
194  std::vector<std::string> splitVariableTypes(const std::string& variable_types) const;
195 };
196 
197 } // namespace rtde_interface
198 } // namespace urcl
199 
200 #endif // UR_CLIENT_LIBRARY_RTDE_CLIENT_H_INCLUDED
static const unsigned MAX_REQUEST_RETRIES
Definition: rtde_client.h:52
comm::URProducer< RTDEPackage > prod_
Definition: rtde_client.h:169
std::vector< std::string > output_recipe_
Definition: rtde_client.h:166
The stream is an abstraction of the TCPSocket that offers reading a full UR data package out of the s...
Definition: stream.h:42
VersionInformation getVersion()
Getter for the UR control version received from the robot.
Definition: rtde_client.h:134
std::vector< std::string > input_recipe_
Definition: rtde_client.h:167
static const std::string PIPELINE_NAME
Definition: rtde_client.h:45
std::vector< std::string > getOutputRecipe()
Getter for the RTDE output recipe.
Definition: rtde_client.h:159
The RTDEWriter class offers an abstraction layer to send data to the robot via the RTDE interface...
Definition: rtde_writer.h:48
comm::Pipeline< RTDEPackage > pipeline_
Definition: rtde_client.h:170
Parent class for notifiers.
Definition: pipeline.h:209
The RTDE specific parser. Interprets a given byte stream as serialized RTDE packages and parses it ac...
Definition: rtde_parser.h:45
Struct containing a robot&#39;s version information.
comm::URStream< RTDEPackage > stream_
Definition: rtde_client.h:165
The RTDEClient class manages communication over the RTDE interface. It contains the RTDE handshake an...
Definition: rtde_client.h:81
double getMaxFrequency() const
Getter for the frequency the robot will publish RTDE data packages with.
Definition: rtde_client.h:124
static const uint16_t MAX_RTDE_PROTOCOL_VERSION
Definition: rtde_client.h:51
The Pipepline manages the production and optionally consumption of packages. Cyclically the producer ...
Definition: pipeline.h:234
A general producer for URPackages. Implements funcionality to produce packages by reading and parsing...
Definition: producer.h:40
VersionInformation urcontrol_version_
Definition: rtde_client.h:173
static const int UR_RTDE_PORT
Definition: rtde_client.h:44


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