create_human_urdf.py
Go to the documentation of this file.
1 import sys
2 import argparse
3 import xacro
4 
5 TPL = "../urdf/human-tpl.xacro"
6 
7 parser = argparse.ArgumentParser(description="Generate the URDF of a human.")
8 parser.add_argument(
9  "-i", "--id", type=str, default="", help="the person's unique ID (default: empty)"
10 )
11 parser.add_argument(
12  "-u",
13  "--upperarm-length",
14  type=float,
15  default=20.0,
16  help="length of the upperarm, in cm (default: 20)",
17 )
18 parser.add_argument(
19  "-f",
20  "--forearm-length",
21  type=float,
22  default=30.0,
23  help="length of the forearm, in cm (default: 30)",
24 )
25 parser.add_argument(
26  "-t",
27  "--torso-height",
28  type=float,
29  default=30.0,
30  help="torso height, in cm (default: 30)",
31 )
32 parser.add_argument(
33  "-s",
34  "--shoulder-to-shoulder",
35  type=float,
36  default=50.0,
37  help="distance between the two shoulders, in cm (default: 50)",
38 )
39 
40 args = parser.parse_args()
41 
42 params = {
43  "id": args.id,
44  "upperarm_length": str(args.upperarm_length / 100.0),
45  "forearm_length": str(args.forearm_length / 100.0),
46  "torso_height": str(args.torso_height / 100.0),
47  "neck_shoulder_length": str((args.shoulder_to_shoulder / 100.0) / 2),
48 }
49 
50 print(xacro.process_file(TPL, mappings=params).toprettyxml(indent=" "))
create_human_urdf.str
str
Definition: create_human_urdf.py:9


human_description
Author(s): Séverin Lemaignan
autogenerated on Tue Feb 6 2024 03:13:50