Commit 5575cfb3 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

update to example-robot-data v2

parent 5ff18e10
......@@ -11,16 +11,16 @@ Load a robot in a viewer, and put it in a standard posture.
```
py=27
qt=4
sudo apt install -qqy robotpkg-py${py}-pinocchio robotpkg-py${py}-qt${qt}-gepetto-viewer-corba robotpkg-example-robot-data robotpkg-osg-dae
sudo apt install -qqy robotpkg-py${py}-qt${qt}-gepetto-viewer-corba robotpkg-py${py}-example-robot-data robotpkg-osg-dae
```
## Available options
Look at `./robots.py -h` to see the list of available robots.
Look at `python -m example_robot_data -h` to see the list of available robots.
## Run
```
gepetto-gui &
./robots.py
python -m example_robot_data [robot]
```
#!/usr/bin/env python
from argparse import ArgumentParser
from pathlib import Path
import pinocchio as pin
from pinocchio.robot_wrapper import RobotWrapper
ROBOTS = {
'talos': 'talos_data/robots/talos_reduced.urdf',
'hyq': 'hyq_description/robots/hyq_no_sensors.urdf',
}
parser = ArgumentParser()
parser.add_argument('robot', nargs='?', default=list(ROBOTS.keys())[0], choices=ROBOTS.keys())
parser.add_argument('--robotpkg_prefix', default='/opt/openrobots')
def main(robotpkg_prefix, robot):
pkg = Path(robotpkg_prefix) / 'share/example-robot-data'
urdf = ROBOTS[robot]
robot = RobotWrapper.BuildFromURDF(str(pkg / urdf), [str(pkg)], pin.JointModelFreeFlyer())
robot.initDisplay()
robot.loadDisplayModel("pinocchio")
robot.display(robot.q0)
if __name__ == '__main__':
main(**vars(parser.parse_args()))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment