-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFrankaState.h
More file actions
58 lines (45 loc) · 1.65 KB
/
FrankaState.h
File metadata and controls
58 lines (45 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef FRANKA_ARM_STATE_HPP
#define FRANKA_ARM_STATE_HPP
#include <array>
#include <string>
#include <chrono>
#include <mutex>
#include <franka/robot_state.h>
struct FrankaArmState {
// Joint space data (7 DOF)
std::array<double, 7> joint_positions; // q - Joint positions [rad]
std::array<double, 7> joint_velocities; // dq - Joint velocities [rad/s]
std::array<double, 7> joint_torques; // tau_J - Joint torques [Nm]
std::array<double, 7> external_torques; // tau_ext_hat_filtered - External torques [Nm]
// Cartesian space data
std::array<double, 16> cartesian_pose; // O_T_EE - End-effector pose (4x4 matrix flattened)
std::array<double, 6> cartesian_velocity; // O_dP_EE - End-effector velocity [m/s, rad/s]
// Metadata
double timestamp; // Timestamp in seconds
bool is_connected; // Connection status
// Thread safety
mutable std::mutex mutex;
// Default constructor
FrankaArmState()
: joint_positions{}
, joint_velocities{}
, joint_torques{}
, external_torques{}
, cartesian_pose{}
, cartesian_velocity{}
, timestamp(0.0)
, is_connected(false) {
}
// TODO: Update state from franka::RobotState
void updateState(const franka::RobotState& robot_state);
// Serialize to JSON string
char encode();
// Static function to deserialize from JSON string
static FrankaArmState deserialize(const char json_str);
};
// TODO: implement FrankaGripperState
struct FrankaGripperState
{
/* data */
};
#endif // FRANKA_ARM_STATE_HPP