Flexiv TDK APIs 1.7
Loading...
Searching...
No Matches
data.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
9#include <array>
10#include <vector>
11#include <cstddef>
12#include <string>
13#include <mutex>
14
15namespace flexiv {
16namespace tdk {
18constexpr size_t kCartDoF = 6;
19
21constexpr size_t kPoseSize = 7;
22
24constexpr size_t kIOPorts = 18;
25
27constexpr double kMaxWrenchFeedbackScale = 3;
28
30constexpr size_t kMaxRobotPairsNum = 2;
31
53{
62
69
74 unsigned int listening_port;
75
82 std::vector<std::string> lan_interface_whitelist = {};
83
90 std::vector<std::string> wan_interface_whitelist = {};
91};
92
101{
106
113 std::vector<std::string> lan_interface_whitelist = {};
114};
115
128
129static const std::string RoleTypeStr[]
130 = {"UNKNOWN", "LAN_TELEOP", "WAN_TELEOP_LEADER", "WAN_TELEOP_FOLLOWER"};
131
137{
138private:
144 std::array<double, kPoseSize> pose {};
153 std::array<double, kCartDoF> velocity {};
154
162 std::array<double, kCartDoF> acceleration {};
163
167 mutable std::mutex mutex;
168
169public:
176 void read(std::array<double, kPoseSize>& out_pose, std::array<double, kCartDoF>& out_velocity,
177 std::array<double, kCartDoF>& out_acceleration) const
178 {
179 std::lock_guard<std::mutex> lock(mutex);
180 out_pose = pose;
181 out_velocity = velocity;
182 out_acceleration = acceleration;
183 }
184
191 void write(const std::array<double, kPoseSize>& in_pose,
192 const std::array<double, kCartDoF>& in_velocity,
193 const std::array<double, kCartDoF>& in_acceleration)
194 {
195 std::lock_guard<std::mutex> lock(mutex);
196 pose = in_pose;
197 velocity = in_velocity;
198 acceleration = in_acceleration;
199 }
200
204 void zero()
205 {
206 std::lock_guard<std::mutex> lock(mutex);
207 pose.fill(0);
208 // q.w() = 1;
209 pose[3] = 1;
210 velocity.fill(0);
211 acceleration.fill(0);
212 }
213};
214
225
226static const std::string CoordTypeStr[] = {"UNKNOWN", "TCP", "WORLD"};
227
233static inline CoordType GetCoordType(const std::string& str)
234{
235 for (size_t i = 0; i < COORD_WORLD - COORD_UNKNOWN + 1; i++) {
236 if (str == CoordTypeStr[i]) {
237 return static_cast<CoordType>(i);
238 }
239 }
240 return COORD_UNKNOWN;
241}
242
250{
255
260 std::array<bool, 3> lock_trans_axis = {false, false, false};
261
266 std::array<bool, 3> lock_ori_axis = {false, false, false};
267};
268
273enum class ZeroFTSensor
274{
275 Enable,
276 Disable
277};
278
299
300static const std::string TeleopIssueCodeStr[] = {"NONE", "JOINT_LIMIT", "SINGULARITY",
301 "HIGH_JOINT_VELOCITY", "HIGH_LATENCY", "NETWORK_DISCONNECTED", "CLOCK_MISMATCH", "ROBOT_FAULT",
302 "ROBOT_NOT_OPERATIONAL", "CONTROL_MODE_MISMATCH"};
303
309{
310 INFO = 0,
313};
314
315static const std::string TeleopIssueLevelStr[] = {"INFO", "WARNING", "ERROR"};
316
322{
323 NONE = 0,
327};
328
329static const std::string TeleopIssueSideStr[] = {"NONE", "LEADER", "FOLLOWER", "NETWORK"};
330
339{
342
345
347 TeleopIssueSide side = TeleopIssueSide::NONE;
348
352 int joint_index = 0;
353
358 bool active = false;
359
361 bool motion_locked = false;
362
364 bool forced_disengage = false;
365
370 double value = 0.0;
371
373 double threshold = 0.0;
374
376 std::string title;
377
379 std::string description;
380
382 std::string suggestion;
383};
384
394{
396 bool initialized = false;
397
399 bool started = false;
400
406 bool engaged = false;
407
409 bool stopped = true;
410
412 bool fault = false;
413
415 bool motion_restricted = false;
416
421 double latency_ms = 0.0;
422
425
428
430 std::vector<TeleopIssue> issues;
431};
432
452
453} // namespace tdk
454} // namespace flexiv
Role
Roles of participants in transparent cartesian teleop.
Definition data.hpp:121
@ LAN_TELEOP
Teleoperation in LAN.
Definition data.hpp:123
@ WAN_TELEOP_LEADER
The leader robot operated by a human during teleoperation over WAN.
Definition data.hpp:124
@ WAN_TELEOP_FOLLOWER
Definition data.hpp:125
@ UNKNOWN
Unknown role.
Definition data.hpp:122
TeleopIssueCode
Issue code and possible reasons for a teleoperation restriction or interruption.
Definition data.hpp:286
@ JOINT_LIMIT
A joint is near its position limit.
Definition data.hpp:288
@ CONTROL_MODE_MISMATCH
Robot left real-time Cartesian motion-force mode.
Definition data.hpp:297
@ ROBOT_NOT_OPERATIONAL
Robot is not operational (E-Stop, disabled, or link lost).
Definition data.hpp:296
@ ROBOT_FAULT
Robot is in fault state.
Definition data.hpp:295
@ NETWORK_DISCONNECTED
Connection to the peer is not established.
Definition data.hpp:293
@ SINGULARITY
Arm is near a kinematic singularity.
Definition data.hpp:289
@ HIGH_JOINT_VELOCITY
Joint velocity is close to the safety limit.
Definition data.hpp:290
@ CLOCK_MISMATCH
Clocks disagree (negative latency); teleop is force-disengaged.
Definition data.hpp:294
TeleopIssueLevel
How urgently a teleop issue should be presented to the operator.
Definition data.hpp:309
@ WARNING
Motion is restricted.
Definition data.hpp:311
@ INFO
Advisory. Motion is still possible.
Definition data.hpp:310
@ ERROR
Teleop was disengaged, stopped, or the robot needs recovery.
Definition data.hpp:312
CoordType
Reference coordinate that the axis to be locked used by transparent cartesian teleop.
Definition data.hpp:220
@ COORD_UNKNOWN
Unknown coordinate.
Definition data.hpp:221
@ COORD_WORLD
WORLD coordinate of local robot.
Definition data.hpp:223
@ COORD_TCP
TCP coordinate of local robot.
Definition data.hpp:222
constexpr size_t kIOPorts
Definition data.hpp:24
constexpr size_t kMaxRobotPairsNum
Definition data.hpp:30
constexpr double kMaxWrenchFeedbackScale
Definition data.hpp:27
TeleopIssueSide
Which participant the issue belongs to.
Definition data.hpp:322
@ NETWORK
Link between the two sides, not a specific robot.
Definition data.hpp:326
@ FOLLOWER
Follower / remote-environment robot.
Definition data.hpp:325
@ LEADER
Leader / operator-side robot.
Definition data.hpp:324
TeleopIssueLevel GetTeleopIssueLevel(TeleopIssueCode code)
Default level for a teleop issue code.
Definition data.hpp:436
ZeroFTSensor
Sensor calibration options.
Definition data.hpp:274
constexpr size_t kPoseSize
Definition data.hpp:21
constexpr size_t kCartDoF
Definition data.hpp:18
Data for locking axis, including reference frame and axis to be locked for transparent cartesian tele...
Definition data.hpp:250
std::array< bool, 3 > lock_ori_axis
Orientation axis lock, the corresponding axis order is . True for locking, false for floating.
Definition data.hpp:266
std::array< bool, 3 > lock_trans_axis
Translation axis lock, the corresponding axis order is . True for locking, false for floating.
Definition data.hpp:260
CoordType coord
Reference coordinate that the axis to be locked.
Definition data.hpp:254
Motion control command struct for general device-robot teleop.
Definition data.hpp:137
void zero()
Thread-safe zero function: set all data to 0.
Definition data.hpp:204
void read(std::array< double, kPoseSize > &out_pose, std::array< double, kCartDoF > &out_velocity, std::array< double, kCartDoF > &out_acceleration) const
Thread-safe read function: copy data to output parameters.
Definition data.hpp:176
void write(const std::array< double, kPoseSize > &in_pose, const std::array< double, kCartDoF > &in_velocity, const std::array< double, kCartDoF > &in_acceleration)
Thread-safe write function: copy the input parameters to member variables.
Definition data.hpp:191
Network configuration for TDK Professional Edition (credential file from TDK Server).
Definition data.hpp:101
std::string client_config_file
Definition data.hpp:105
std::vector< std::string > lan_interface_whitelist
Definition data.hpp:113
TCP Server and Client Configuration TDK Standard Edition. In a teleoperation-over-WAN setup,...
Definition data.hpp:53
std::string public_ipv4_address
Definition data.hpp:68
std::vector< std::string > lan_interface_whitelist
Definition data.hpp:82
unsigned int listening_port
Definition data.hpp:74
std::vector< std::string > wan_interface_whitelist
Definition data.hpp:90
One restriction or interruption that the operator should understand.
Definition data.hpp:339
TeleopIssueLevel level
Definition data.hpp:344
TeleopIssueSide side
Definition data.hpp:347
std::string description
Definition data.hpp:379
TeleopIssueCode code
Definition data.hpp:341
std::string suggestion
Definition data.hpp:382
Snapshot of teleoperation health for one robot pair.
Definition data.hpp:394
std::vector< TeleopIssue > issues
Definition data.hpp:430