Flexiv TDK APIs 2.1
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#include <flexiv/rdk/data.hpp>
15
16namespace flexiv {
17namespace tdk {
19constexpr size_t kCartDoF = 6;
20
22constexpr size_t kPoseSize = 7;
23
25constexpr size_t kIOPorts = 16 + 2 * 2;
26
28constexpr double kMaxWrenchFeedbackScale = 3;
29
31constexpr size_t kMaxRobotPairsNum = 2;
32
56{
65
72
77 unsigned int listening_port;
78
87 std::vector<std::string> wan_interface_whitelist = {};
88};
89
102
103static const std::string RoleTypeStr[]
104 = {"UNKNOWN", "LAN_TELEOP", "WAN_TELEOP_LEADER", "WAN_TELEOP_FOLLOWER"};
105
111{
112private:
118 std::array<double, kPoseSize> pose {};
127 std::array<double, kCartDoF> velocity {};
128
136 std::array<double, kCartDoF> acceleration {};
137
141 mutable std::mutex mutex;
142
143public:
150 void read(std::array<double, kPoseSize>& out_pose, std::array<double, kCartDoF>& out_velocity,
151 std::array<double, kCartDoF>& out_acceleration) const
152 {
153 std::lock_guard<std::mutex> lock(mutex);
154 out_pose = pose;
155 out_velocity = velocity;
156 out_acceleration = acceleration;
157 }
158
165 void write(const std::array<double, kPoseSize>& in_pose,
166 const std::array<double, kCartDoF>& in_velocity,
167 const std::array<double, kCartDoF>& in_acceleration)
168 {
169 std::lock_guard<std::mutex> lock(mutex);
170 pose = in_pose;
171 velocity = in_velocity;
172 acceleration = in_acceleration;
173 }
174
178 void zero()
179 {
180 std::lock_guard<std::mutex> lock(mutex);
181 pose.fill(0);
182 // q.w() = 1;
183 pose[3] = 1;
184 velocity.fill(0);
185 acceleration.fill(0);
186 }
187};
188
194{
195 COORD_UNKNOWN = 0,
198};
199
200static const std::string CoordTypeStr[] = {"UNKNOWN", "TCP", "WORLD"};
201
207static inline CoordType GetCoordType(const std::string& str)
208{
209 for (size_t i = 0; i < COORD_WORLD - COORD_UNKNOWN + 1; i++) {
210 if (str == CoordTypeStr[i]) {
211 return static_cast<CoordType>(i);
212 }
213 }
214 return COORD_UNKNOWN;
215}
216
224{
228 CoordType coord = CoordType::COORD_UNKNOWN;
229
234 std::array<bool, 3> lock_trans_axis = {false, false, false};
235
240 std::array<bool, 3> lock_ori_axis = {false, false, false};
241};
242
247enum class ZeroFTSensor
248{
249 Enable,
250 Disable
251};
252
253} // namespace tdk
254} // namespace flexiv
Role
Roles of participants in transparent cartesian teleop.
Definition data.hpp:95
@ LAN_TELEOP
Definition data.hpp:97
@ WAN_TELEOP_LEADER
Definition data.hpp:98
@ WAN_TELEOP_FOLLOWER
Definition data.hpp:99
CoordType
Reference coordinate that the axis to be locked used by transparent cartesian teleop.
Definition data.hpp:194
@ COORD_WORLD
Definition data.hpp:197
constexpr size_t kIOPorts
Definition data.hpp:25
constexpr size_t kMaxRobotPairsNum
Definition data.hpp:31
constexpr double kMaxWrenchFeedbackScale
Definition data.hpp:28
ZeroFTSensor
Sensor calibration options.
Definition data.hpp:248
constexpr size_t kPoseSize
Definition data.hpp:22
constexpr size_t kCartDoF
Definition data.hpp:19
Data for locking axis, including reference frame and axis to be locked for transparent cartesian tele...
Definition data.hpp:224
std::array< bool, 3 > lock_ori_axis
Orientation axis lock, the corresponding axis order is . True for locking, false for floating.
Definition data.hpp:240
std::array< bool, 3 > lock_trans_axis
Translation axis lock, the corresponding axis order is . True for locking, false for floating.
Definition data.hpp:234
CoordType coord
Reference coordinate that the axis to be locked.
Definition data.hpp:228
Motion control command struct for general device-robot teleop.
Definition data.hpp:111
void zero()
Thread-safe zero function: set all data to 0.
Definition data.hpp:178
void read(std::array< double, kPoseSize > &out_pose, std::array< double, kCartDoF > &out_velocity, std::array< double, kCartDoF > &out_acceleration) const
Tread-safe read function: copy data to output parameters.
Definition data.hpp:150
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:165
TCP Server and Client Configuration TDK Standard Edition. In TDK standard edition,...
Definition data.hpp:56
std::string public_ipv4_address
Definition data.hpp:71
unsigned int listening_port
Definition data.hpp:77
std::vector< std::string > wan_interface_whitelist
Definition data.hpp:87