Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hpp_tutorial
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
Humanoid Path Planner
hpp_tutorial
Commits
1879b92e
Commit
1879b92e
authored
9 years ago
by
Pierre Fernbach
Browse files
Options
Downloads
Patches
Plain Diff
add tutorial to display the roadmap (based of tutorial_1)
parent
6e826e2a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
script/tutorial_1_roadmap.py
+74
-0
74 additions, 0 deletions
script/tutorial_1_roadmap.py
with
74 additions
and
0 deletions
script/tutorial_1_roadmap.py
0 → 100644
+
74
−
0
View file @
1879b92e
from
hpp.corbaserver.pr2
import
Robot
from
hpp.corbaserver
import
ProblemSolver
from
hpp.gepetto
import
Viewer
from
hpp.gepetto
import
PathPlayer
# define colors for the roadmap
white
=
[
1.0
,
1.0
,
1.0
,
1.0
]
green
=
[
0.23
,
0.75
,
0.2
,
0.5
]
brown
=
[
0.85
,
0.75
,
0.15
,
0.5
]
blue
=
[
0.0
,
0.0
,
0.8
,
1.0
]
grey
=
[
0.7
,
0.7
,
0.7
,
1.0
]
red
=
[
0.8
,
0.0
,
0.0
,
1.0
]
robot
=
Robot
(
'
pr2
'
)
robot
.
setJointBounds
(
"
base_joint_xy
"
,
[
-
4
,
-
3
,
-
5
,
-
3
])
ps
=
ProblemSolver
(
robot
)
v
=
Viewer
(
ps
)
q_init
=
robot
.
getCurrentConfig
()
q_goal
=
q_init
[::]
q_init
[
0
:
2
]
=
[
-
3.2
,
-
4
]
rank
=
robot
.
rankInConfiguration
[
'
torso_lift_joint
'
]
q_init
[
rank
]
=
0.2
v
(
q_init
)
q_goal
[
0
:
2
]
=
[
-
3.2
,
-
4
]
rank
=
robot
.
rankInConfiguration
[
'
l_shoulder_lift_joint
'
]
q_goal
[
rank
]
=
0.5
rank
=
robot
.
rankInConfiguration
[
'
l_elbow_flex_joint
'
]
q_goal
[
rank
]
=
-
0.5
rank
=
robot
.
rankInConfiguration
[
'
r_shoulder_lift_joint
'
]
q_goal
[
rank
]
=
0.5
rank
=
robot
.
rankInConfiguration
[
'
r_elbow_flex_joint
'
]
q_goal
[
rank
]
=
-
0.5
#r (q_goal)
v
.
loadObstacleModel
(
"
iai_maps
"
,
"
kitchen_area
"
,
"
kitchen
"
)
ps
.
setInitialConfig
(
q_init
)
ps
.
addGoalConfig
(
q_goal
)
#ps.selectPathPlanner("rrtConnect")
ps
.
solve
()
# display roadmap for the base of the robot (no specified joint)
v
.
displayRoadmap
(
"
rmB
"
,
white
,
0.02
,
1
,
green
)
# display the path found in the roadmap :
v
.
displayPathMap
(
"
rmPath
"
,
0
,
red
,
0.03
,
1
,
red
)
# hide previous roadmap
v
.
client
.
gui
.
removeFromGroup
(
"
rmB
"
,
v
.
sceneName
)
v
.
client
.
gui
.
removeFromGroup
(
"
rmPath
"
,
v
.
sceneName
)
#display roadmap for the tools :
v
.
displayRoadmap
(
"
rmR
"
,
blue
,
0.02
,
1
,
green
,
'
r_gripper_tool_joint
'
)
v
.
displayRoadmap
(
"
rmL
"
,
red
,
0.02
,
1
,
grey
,
'
l_gripper_tool_joint
'
)
# alternative method : replace ps.solve() and v.displayRoadmap() with :
# v.solveAndDisplay("rmR",2,blue,0.02,1,green,'r_gripper_tool_joint')
# v.displayRoadmap("rmL",red,0.02,1,grey,'l_gripper_tool_joint')
################################################################
pp
=
PathPlayer
(
robot
.
client
,
v
)
#display path
pp
(
0
)
#display path with post-optimisation
pp
(
1
)
# hide roadmap in the scene
v
.
client
.
gui
.
removeFromGroup
(
"
rmL
"
,
v
.
sceneName
)
v
.
client
.
gui
.
removeFromGroup
(
"
rmR
"
,
v
.
sceneName
)
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