forward_kinematics/
forward_kinematics.rs1use dynamics_rs::prelude::*;
2
3fn main() {
4 let urdf_path = "./examples/descriptions/ur5/ur5_robot.urdf"; let mesh_path = "./examples/descriptions/ur5/"; let (model, _coll_model, _viz_model) =
9 build_models_from_urdf(urdf_path, Some(mesh_path)).expect("Failed to parse URDF file");
10
11 let q = random_configuration(&model);
13 println!("Random configuration q: {}", q);
14
15 let mut data = model.create_data();
17
18 forward_kinematics(&model, &mut data, &q, None, None)
20 .expect("Failed to compute forward kinematics");
21
22 let id = model.get_joint_id("wrist_3_joint").unwrap();
24 let placement = &data.joint_placements[id];
25 println!("Placement of 'wrist_3_joint':\n{}", placement);
26
27 update_frame_placements(&model, &mut data);
29
30 let frame_id = model.get_frame_id("tool0", None).unwrap();
32 let frame_placement = &data.frame_placements[frame_id];
34 println!("Placement of frame 'tool0':\n{}", frame_placement);
35}