script_command_interface.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_SCRIPT_COMMAND_INTERFACE_H_INCLUDED
30 #define UR_CLIENT_LIBRARY_SCRIPT_COMMAND_INTERFACE_H_INCLUDED
31 
34 
35 namespace urcl
36 {
37 namespace control
38 {
42 enum class ToolContactResult : int32_t
43 {
44 
47 };
48 
56 {
57 public:
58  ScriptCommandInterface() = delete;
64  ScriptCommandInterface(uint32_t port);
65 
71  bool zeroFTSensor();
72 
82  bool setPayload(const double mass, const vector3d_t* cog);
83 
91  bool setToolVoltage(const ToolVoltage voltage);
92 
114  bool startForceMode(const vector6d_t* task_frame, const vector6uint32_t* selection_vector, const vector6d_t* wrench,
115  const unsigned int type, const vector6d_t* limits);
116 
122  bool endForceMode();
123 
131  bool startToolContact();
132 
139  bool endToolContact();
140 
145  bool clientConnected();
146 
152  void setToolContactResultCallback(std::function<void(ToolContactResult)> callback)
153  {
154  handle_tool_contact_result_ = callback;
155  }
156 
157 protected:
158  virtual void connectionCallback(const int filedescriptor) override;
159 
160  virtual void disconnectionCallback(const int filedescriptor) override;
161 
162  virtual void messageCallback(const int filedescriptor, char* buffer, int nbytesrecv) override;
163 
164 private:
168  enum class ScriptCommand : int32_t
169  {
170 
171  ZERO_FTSENSOR = 0,
172  SET_PAYLOAD = 1,
173  SET_TOOL_VOLTAGE = 2,
174  START_FORCE_MODE = 3,
175  END_FORCE_MODE = 4,
176  START_TOOL_CONTACT = 5,
177  END_TOOL_CONTACT = 6,
178  };
179 
181  static const int MAX_MESSAGE_LENGTH = 26;
182 
183  std::function<void(ToolContactResult)> handle_tool_contact_result_;
184 };
185 
186 } // namespace control
187 } // namespace urcl
188 
189 #endif // UR_CLIENT_LIBRARY_SCRIPT_COMMAND_INTERFACE_H_INCLUDED
ToolVoltage
Possible values for the tool voltage.
The ScriptCommandInterface class starts a TCPServer for a robot to connect to and this connection is ...
std::array< double, 3 > vector3d_t
Definition: types.h:29
void setToolContactResultCallback(std::function< void(ToolContactResult)> callback)
Set the tool contact result callback object.
ToolContactResult
Types for encoding until tool contact execution result.
std::array< uint32_t, 6 > vector6uint32_t
Definition: types.h:32
std::array< double, 6 > vector6d_t
Definition: types.h:30
The ReverseInterface class handles communication to the robot. It starts a server and waits for the r...
std::function< void(ToolContactResult)> handle_tool_contact_result_


ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Tue Jul 4 2023 02:09:47