8 from robot_descriptions.loaders.pinocchio
import load_robot_description
9 except ModuleNotFoundError:
10 print(
"This example loads robot descriptions from robot_descriptions.py:")
11 print(
"\n\tpip install robot_descriptions")
13 print(
"Goal: load a legged robot from its URDF, then modify leg lengths")
15 print(
"Loading robot description from URDF...")
16 robot = load_robot_description(
"upkie_description")
21 known_offsets = {
"knee": 0.072,
"wheel": 0.065}
25 print(f
"Checking that limbs are {limb_length} m long... ", end=
"")
26 for side
in (
"left",
"right"):
27 for joint
in (
"knee",
"wheel"):
28 joint_id = model.getJointId(f
"{side}_{joint}")
30 model.jointPlacements[joint_id].translation[1],
31 limb_length - known_offsets[joint],
33 print(
"{side}_{joint} placement is wrong!")
40 print(
"OK, the model is as we expect it")
44 """Update femur and tibia lengths in the robot model.
47 length: New femur and tibia length, in meters.
49 for side
in (
"left",
"right"):
50 for joint
in (
"knee",
"wheel"):
51 joint_id = model.getJointId(f
"{side}_{joint}")
52 model.jointPlacements[joint_id].translation[1] = (
53 length - known_offsets[joint]
59 print(
"OK, the update worked!")