Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gepetto
example-robot-data
Commits
554ce5ee
Commit
554ce5ee
authored
Aug 28, 2019
by
Guilhem Saurel
Browse files
use ArgumentParser
parent
db11e872
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
554ce5ee
...
...
@@ -36,3 +36,10 @@ If you have never added robotpkg as a softwares repository, please follow first
4.
The installation of example-robot-data:
sudo apt install robotpkg-example-robot-data
## Show the robot
(you will need pinocchio and its python bindings)
`python -m example_robot_data [hyq,talos,talos_arm,tiago,tiago_no_hand,icub]`
example_robot_data/__main__.py
View file @
554ce5ee
import
sys
from
argparse
import
ArgumentParser
from
.
import
robots_loader
DISPLAY_HYQ
=
'hyq'
in
sys
.
argv
DISPLAY_TALOS
=
'talos'
in
sys
.
argv
DISPLAY_TALOS_ARM
=
'talos_arm'
in
sys
.
argv
DISPLAY_TALOS_LEGS
=
'talos_legs'
in
sys
.
argv
DISPLAY_TIAGO
=
'tiago'
in
sys
.
argv
DISPLAY_TIAGO_NO_HAND
=
'tiago_no_hand'
in
sys
.
argv
DISPLAY_ICUB
=
'icub'
in
sys
.
argv
ROBOTS
=
[
'hyq'
,
'talos'
,
'talos_arm'
,
'talos_legs'
,
'tiago'
,
'tiago_no_hand'
,
'icub'
]
if
DISPLAY_HYQ
:
parser
=
ArgumentParser
()
parser
.
add_argument
(
'robot'
,
nargs
=
'?'
,
default
=
ROBOTS
[
0
],
choices
=
ROBOTS
)
args
=
parser
.
parse_args
()
if
args
.
robot
==
'hyq'
:
hyq
=
robots_loader
.
loadHyQ
()
hyq
.
init
Viewer
(
loadModel
=
True
)
hyq
.
init
Display
(
loadModel
=
True
)
hyq
.
display
(
hyq
.
q0
)
if
DISPLAY_TALOS
:
el
if
args
.
robot
==
'talos'
:
talos
=
robots_loader
.
loadTalos
()
talos
.
init
Viewer
(
loadModel
=
True
)
talos
.
init
Display
(
loadModel
=
True
)
talos
.
display
(
talos
.
q0
)
if
DISPLAY_TALOS_ARM
:
el
if
args
.
robot
==
'talos_arm'
:
talos_arm
=
robots_loader
.
loadTalosArm
()
talos_arm
.
init
Viewer
(
loadModel
=
True
)
talos_arm
.
init
Display
(
loadModel
=
True
)
talos_arm
.
display
(
talos_arm
.
q0
)
if
DISPLAY_TALOS_LEGS
:
if
args
.
robot
==
'laso_legs'
:
talos_legs
=
robots_loader
.
loadTalosLegs
()
talos_legs
.
initViewer
(
loadModel
=
True
)
talos_legs
.
display
(
talos_legs
.
q0
)
if
DISPLAY_TIAGO
:
el
if
args
.
robot
==
'tiago'
:
tiago
=
robots_loader
.
loadTiago
()
tiago
.
init
Viewer
(
loadModel
=
True
)
tiago
.
init
Display
(
loadModel
=
True
)
tiago
.
display
(
tiago
.
q0
)
if
DISPLAY_TIAGO_NO_HAND
:
el
if
args
.
robot
==
'tiago_no_hand'
:
tiago_no_hand
=
robots_loader
.
loadTiagoNoHand
()
tiago_no_hand
.
init
Viewer
(
loadModel
=
True
)
tiago_no_hand
.
init
Display
(
loadModel
=
True
)
tiago_no_hand
.
display
(
tiago_no_hand
.
q0
)
if
DISPLAY_ICUB
:
el
if
args
.
robot
==
'icub'
:
icub
=
robots_loader
.
loadICub
()
icub
.
init
Viewer
(
loadModel
=
True
)
icub
.
init
Display
(
loadModel
=
True
)
icub
.
display
(
icub
.
q0
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment