Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gepetto-demos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Guilhem Saurel
gepetto-demos
Commits
2e4aa090
Commit
2e4aa090
authored
5 years ago
by
Guilhem Saurel
Browse files
Options
Downloads
Patches
Plain Diff
integration_utils.py
parent
92d9e01e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gv_talos.py
+5
-12
5 additions, 12 deletions
gv_talos.py
integration_utils.py
+31
-0
31 additions, 0 deletions
integration_utils.py
with
36 additions
and
12 deletions
gv_talos.py
+
5
−
12
View file @
2e4aa090
#!/usr/bin/env python2
#!/usr/bin/env python2
from
argparse
import
ArgumentParser
from
pathlib
import
Path
from
pathlib
import
Path
from
subprocess
import
Popen
import
pinocchio
as
pin
import
pinocchio
as
pin
from
pinocchio.robot_wrapper
import
RobotWrapper
from
pinocchio.robot_wrapper
import
RobotWrapper
parser
=
ArgumentParser
()
from
integration_utils
import
wrap_with_processes
parser
.
add_argument
(
'
robotpkg_prefix
'
,
nargs
=
'
?
'
,
default
=
'
/opt/openrobots
'
)
DEPS
=
[
'
py-pinocchio
'
,
'
py-qt-gepetto-viewer-corba
'
,
'
example-robot-data
'
]
def
main
(
robotpkg_prefix
):
def
main
(
robotpkg_prefix
,
**
kwargs
):
pkg
=
Path
(
robotpkg_prefix
)
/
'
share/example-robot-data
'
pkg
=
Path
(
robotpkg_prefix
)
/
'
share/example-robot-data
'
urdf
=
'
talos_data/robots/talos_reduced.urdf
'
urdf
=
'
talos_data/robots/talos_reduced.urdf
'
robot
=
RobotWrapper
.
BuildFromURDF
(
str
(
pkg
/
urdf
),
[
str
(
pkg
)],
pin
.
JointModelFreeFlyer
())
robot
=
RobotWrapper
.
BuildFromURDF
(
str
(
pkg
/
urdf
),
[
str
(
pkg
)],
pin
.
JointModelFreeFlyer
())
...
@@ -21,10 +20,4 @@ def main(robotpkg_prefix):
...
@@ -21,10 +20,4 @@ def main(robotpkg_prefix):
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
gepetto_gui
=
Popen
(
'
gepetto-gui
'
)
wrap_with_processes
([
'
gepetto-gui
'
],
main
,
DEPS
)
try
:
main
(
**
vars
(
parser
.
parse_args
()))
finally
:
gepetto_gui
.
terminate
()
print
(
'
Done. Press Enter to exit
'
)
raw_input
()
This diff is collapsed.
Click to expand it.
integration_utils.py
0 → 100644
+
31
−
0
View file @
2e4aa090
from
argparse
import
ArgumentParser
from
subprocess
import
CalledProcessError
,
Popen
,
check_call
parser
=
ArgumentParser
()
parser
.
add_argument
(
'
robotpkg_prefix
'
,
nargs
=
'
?
'
,
default
=
'
/opt/openrobots
'
)
parser
.
add_argument
(
'
python
'
,
nargs
=
'
?
'
,
default
=
27
)
parser
.
add_argument
(
'
qt
'
,
nargs
=
'
?
'
,
default
=
4
)
def
wrap_with_processes
(
processes
,
f
,
deps
):
kwargs
=
vars
(
parser
.
parse_args
())
check_installed
(
deps
,
**
kwargs
)
try
:
plist
=
[
Popen
(
process
)
for
process
in
processes
]
f
(
**
kwargs
)
print
(
'
Done. Press Enter to exit
'
)
raw_input
()
finally
:
for
process
in
plist
:
process
.
terminate
()
def
check_installed
(
pkgs
,
python
,
qt
,
**
kwargs
):
for
pkg_name
in
pkgs
:
pkg
=
'
robotpkg-
'
+
pkg_name
pkg
=
pkg
.
replace
(
'
py-
'
,
'
py%i-
'
%
python
)
pkg
=
pkg
.
replace
(
'
qt-
'
,
'
qt%i-
'
%
qt
)
try
:
check_call
([
'
dpkg
'
,
'
-s
'
,
pkg
])
except
CalledProcessError
:
print
(
'
please run: sudo apt install -qqy %s
'
%
pkg
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment