robotics_signals/sensors/
multi_dof_joint_state.rs

1use cdds_derive::*;
2use cyclonedds_rs::*;
3use serde_derive::{Deserialize, Serialize};
4
5use crate::{
6    geometry::{Transform, Twist, Wrench},
7    standard::Header,
8};
9
10/// Representation of state for joints with multiple degrees of freedom,
11/// following the structure of JointState which can only represent a single degree of freedom.
12///
13/// It is assumed that a joint in a system corresponds to a transform that gets applied
14/// along the kinematic chain. For example, a planar joint (as in URDF) is 3DOF (x, y, yaw)
15/// and those 3DOF can be expressed as a transformation matrix, and that transformation
16/// matrix can be converted back to (x, y, yaw)
17///
18/// Each joint is uniquely identified by its name
19/// The header specifies the time at which the joint states were recorded. All the joint states
20/// in one message have to be recorded at the same time.
21///
22/// This message consists of a multiple arrays, one for each part of the joint state.
23/// The goal is to make each of the fields optional. When e.g. your joints have no
24/// wrench associated with them, you can leave the wrench array empty.
25///
26/// All arrays in this message should have the same size, or be empty.
27/// This is the only way to uniquely associate the joint name with the correct
28/// states.
29
30#[repr(C)]
31#[derive(Serialize, Deserialize, Topic)]
32pub struct MultiDOFJointState {
33    pub header: Header,
34    pub joint_names: Vec<String>,
35    pub transforms: Vec<Transform>,
36    pub twist: Vec<Twist>,
37    pub wrench: Vec<Wrench>,
38}