-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathvisualizer_example_3.py
More file actions
39 lines (32 loc) · 893 Bytes
/
visualizer_example_3.py
File metadata and controls
39 lines (32 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import sys
import pathlib
import optas
from optas.visualize import Visualizer
cwd = pathlib.Path(__file__).parent.resolve() # path to current working directory
if "lbr" in sys.argv:
model = "lbr"
elif "lwr" in sys.argv:
model = "lwr"
else:
model = "lwr"
if model == "lwr":
urdf_filename = os.path.join(cwd, "robots", "kuka_lwr", "kuka_lwr.urdf")
robot_model = optas.RobotModel(urdf_filename=urdf_filename)
elif model == "lbr":
xacro_filename = os.path.join(cwd, "robots", "kuka_lbr", "med7.urdf.xacro")
robot_model = optas.RobotModel(xacro_filename=xacro_filename)
vis = Visualizer(camera_position=[3, 3, 3])
vis.grid_floor()
vis.robot(
robot_model,
q=robot_model.get_random_joint_positions(),
show_links=True,
display_link_names=True,
link_names_alpha=0.4,
)
save = True
if save:
vis.save('vis.png')
else:
vis.start()