-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_plugin.py
44 lines (32 loc) · 1.07 KB
/
test_plugin.py
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
40
41
42
43
44
#!/usr/bin/env python3
import os
from pathlib import Path
from openravepy import *
# set up the plugin path
plugin_library_path = Path(__file__).resolve().parent / "build/src"
openrave_plugin_path = os.getenv("OPENRAVE_PLUGINS", "")
os.environ["OPENRAVE_PLUGINS"] = os.pathsep.join(
[str(plugin_library_path), openrave_plugin_path]
)
print("OPENRAVE_PLUGINS:", os.environ["OPENRAVE_PLUGINS"])
try:
RaveInitialize()
if not RaveLoadPlugin("raveurdf"):
raveLogError("Plugin not correctly loaded")
env = Environment()
env.SetViewer("qtcoin")
env.Load("scenes/myscene.env.xml")
MyModule = RaveCreateModule(env, "raveurdf")
arg = "load {:s}".format("./robots/panda.urdf")
MyModule.SendCommand(arg)
robot = env.GetRobots()[0]
print(f"Robot name: {robot.GetName()}")
print(f"Robot DOF: {robot.GetDOF()}")
print(f"Robot joints: {robot.GetJoints()}")
print(f"Robot links: {robot.GetLinks()}")
from IPython import embed
embed()
except Exception as e:
print(f"Failed to load module: {e}")
finally:
RaveDestroy()