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