Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hpp-rbprm-corba
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
Jason Chemin
hpp-rbprm-corba
Commits
240d70e9
Commit
240d70e9
authored
7 years ago
by
Steve Tonneau
Browse files
Options
Downloads
Patches
Plain Diff
displying com found
parent
df97d14a
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/scenarios/demos/siggraph_asia/plane_hrp2_interp.py
+59
-13
59 additions, 13 deletions
script/scenarios/demos/siggraph_asia/plane_hrp2_interp.py
with
59 additions
and
13 deletions
script/scenarios/demos/siggraph_asia/plane_hrp2_interp.py
+
59
−
13
View file @
240d70e9
...
...
@@ -50,7 +50,7 @@ lArmNormal = [0,0,1]
lArmx
=
0.024
;
lArmy
=
0.024
#~ fullBody.addLimb(larmId,larm,lHand,lArmOffset,lArmNormal, lArmx, lArmy, 10000, "manipulability", 0.1, "_6_DOF", False,grasp = True)
#~ fullBody.addLimb(larmId,larm,lHand,lArmOffset,lArmNormal, lArmx, lArmy, 10000, "manipulability", 0.1, "_6_DOF", True)
fullBody
.
addLimb
(
larmId
,
larm
,
lHand
,
lArmOffset
,
lArmNormal
,
lArmx
,
lArmy
,
10000
,
"
manipulability
"
,
0.1
,
"
_6_DOF
"
)
#~
fullBody.addLimb(larmId,larm,lHand,lArmOffset,lArmNormal, lArmx, lArmy, 10000, "manipulability", 0.1, "_6_DOF")
#~ fullBody.addLimb(larmId,larm,lHand,lArmOffset,lArmNormal, lArmx, lArmy, 10000, 0.05)
...
...
@@ -63,7 +63,7 @@ rArmx = 0.024; rArmy = 0.024
#disabling collision for hook
#~ fullBody.addLimb(rarmId,rarm,rHand,rArmOffset,rArmNormal, rArmx, rArmy, 10000, "manipulability", 0.1, "_6_DOF", False,grasp = True)
#~ fullBody.addLimb(rarmId,rarm,rHand,rArmOffset,rArmNormal, rArmx, rArmy, 10000, "manipulability", 0.1, "_6_DOF", True)
fullBody
.
addLimb
(
rarmId
,
rarm
,
rHand
,
rArmOffset
,
rArmNormal
,
rArmx
,
rArmy
,
10000
,
"
manipulability
"
,
0.1
,
"
_6_DOF
"
)
#~
fullBody.addLimb(rarmId,rarm,rHand,rArmOffset,rArmNormal, rArmx, rArmy, 10000, "manipulability", 0.1, "_6_DOF")
fullBody
.
runLimbSampleAnalysis
(
rLegId
,
"
jointLimitsDistance
"
,
True
)
fullBody
.
runLimbSampleAnalysis
(
lLegId
,
"
jointLimitsDistance
"
,
True
)
...
...
@@ -123,8 +123,8 @@ configs = []
#~ f1.close()
limbsCOMConstraints
=
{
rLegId
:
{
'
file
'
:
"
hrp2/RL_com.ineq
"
,
'
effector
'
:
'
RLEG_JOINT5
'
},
lLegId
:
{
'
file
'
:
"
hrp2/LL_com.ineq
"
,
'
effector
'
:
'
LLEG_JOINT5
'
},
rarmId
:
{
'
file
'
:
"
hrp2/RA_com.ineq
"
,
'
effector
'
:
rHand
}
}
lLegId
:
{
'
file
'
:
"
hrp2/LL_com.ineq
"
,
'
effector
'
:
'
LLEG_JOINT5
'
},
}
#~
rarmId : {'file': "hrp2/RA_com.ineq", 'effector' : rHand} }
#~ larmId : {'file': "hrp2/LA_com.ineq", 'effector' : lHand} }
#~ fullBody.limbRRTFromRootPath(0,len(configs)-1,0,2)
...
...
@@ -277,6 +277,8 @@ def play_all_paths_qs():
def
test
(
stateid
=
1
,
path
=
False
,
use_rand
=
False
,
just_one_curve
=
False
,
num_optim
=
0
,
effector
=
False
)
:
com_1
=
__get_com
(
fullBody
,
configs
[
stateid
])
com_2
=
__get_com
(
fullBody
,
configs
[
stateid
+
1
])
createPtBox
(
r
.
client
.
gui
,
0
,
com_1
,
0.01
,
[
0
,
1
,
1
,
1.
])
createPtBox
(
r
.
client
.
gui
,
0
,
com_2
,
0.01
,
[
0
,
1
,
1
,
1.
])
data
=
gen_sequence_data_from_state
(
fullBody
,
stateid
,
configs
,
mu
=
0.3
)
c_bounds_1
=
get_com_constraint
(
fullBody
,
stateid
,
configs
[
stateid
],
limbsCOMConstraints
,
interm
=
False
)
c_bounds_mid
=
get_com_constraint
(
fullBody
,
stateid
,
configs
[
stateid
],
limbsCOMConstraints
,
interm
=
True
)
...
...
@@ -292,6 +294,8 @@ def test(stateid = 1, path = False, use_rand = False, just_one_curve = False, nu
if
just_one_curve
:
print
"
just one curve
"
bezier_0
,
curve
=
__Bezier
([
com_1
,
c_mid_1
[
0
].
tolist
(),
c_mid_2
[
0
].
tolist
(),
com_2
])
createPtBox
(
r
.
client
.
gui
,
0
,
c_mid_1
[
0
].
tolist
(),
0.01
,
[
0
,
1
,
1
,
1.
])
createPtBox
(
r
.
client
.
gui
,
0
,
c_mid_2
[
0
].
tolist
(),
0.01
,
[
0
,
1
,
1
,
1.
])
partions
=
[
0.
,
0.3
,
0.7
,
1.
]
p0
=
fullBody
.
generateCurveTrajParts
(
bezier_0
,
partions
)
...
...
@@ -350,19 +354,61 @@ def test(stateid = 1, path = False, use_rand = False, just_one_curve = False, nu
#~ pp(29),pp(9),pp(17)
from
hpp.corbaserver.rbprm.tools.path_to_trajectory
import
*
b_id
=
0
scene
=
"
bos
"
r
.
client
.
gui
.
createScene
(
scene
)
def
createPtBox
(
gui
,
winId
,
config
,
res
=
0.01
,
color
=
[
1
,
1
,
1
,
0.3
]):
resolution
=
res
global
scene
global
b_id
boxname
=
scene
+
"
/
"
+
str
(
b_id
)
b_id
+=
1
gui
.
addBox
(
boxname
,
resolution
,
resolution
,
resolution
,
color
)
gui
.
applyConfiguration
(
boxname
,[
config
[
0
],
config
[
1
],
config
[
2
],
1
,
0
,
0
,
0
])
gui
.
addSceneToWindow
(
scene
,
winId
)
gui
.
refresh
()
def
test_ineq
(
stateid
,
constraints
,
n_samples
=
10
,
color
=
[
1
,
1
,
1
,
1.
]):
Kin
=
get_com_constraint
(
fullBody
,
stateid
,
configs
[
stateid
],
constraints
,
interm
=
False
)
#~ print "kin ", Kin
#create box around current com
fullBody
.
setCurrentConfig
(
configs
[
stateid
])
com
=
fullBody
.
getCenterOfMass
()
createPtBox
(
r
.
client
.
gui
,
0
,
com
,
0.1
,
color
)
bounds_c
=
flatten
([[
com
[
i
]
-
1.
,
com
[
i
]
+
1.
]
for
i
in
range
(
3
)])
# arbitrary
for
i
in
range
(
n_samples
):
c
=
array
([
uniform
(
bounds_c
[
2
*
i
],
bounds_c
[
2
*
i
+
1
])
for
i
in
range
(
3
)])
print
"
c:
"
,
c
if
(
Kin
[
0
].
dot
(
c
)
<=
Kin
[
1
]).
all
():
print
"
boundaries satisfied
"
createPtBox
(
r
.
client
.
gui
,
0
,
c
,
0.01
,
color
)
#~ test_ineq(0,{ rLegId : {'file': "hrp2/RL_com.ineq", 'effector' : 'RLEG_JOINT5'}}, 1000, [1,0,0,1])
#~ test_ineq(0,{ lLegId : {'file': "hrp2/LL_com.ineq", 'effector' : 'LLEG_JOINT5'}}, 1000, [0,1,0,1])
#~ test_ineq(0,{ rLegId : {'file': "hrp2/RA_com.ineq", 'effector' : rHand}}, 1000, [0,0,1,1])
#~ test_ineq(0,{ rLegId : {'file': "hrp2/RL_com.ineq", 'effector' : 'RLEG_JOINT5'}}, 1000, [0,1,1,1])
#~ test_ineq(0, limbsCOMConstraints, 1000, [0,1,1,1])
def
gen
(
start
=
0
,
len_con
=
1
,
num_optim
=
0
,
ine_curve
=
True
,
s
=
1.
,
effector
=
False
):
n_fail
=
0
;
for
i
in
range
(
start
,
start
+
len_con
):
if
not
test
(
i
,
True
,
False
,
ine_curve
,
num_optim
)[
0
]:
found
=
False
for
j
in
range
(
10
):
found
=
test
(
i
,
True
,
True
,
ine_curve
,
num_optim
)[
0
]
if
found
:
break
if
not
found
:
n_fail
+=
1
res
=
test
(
i
,
True
,
False
,
ine_curve
,
num_optim
)
if
(
not
res
[
0
]):
createPtBox
(
r
.
client
.
gui
,
0
,
res
[
1
][
0
],
0.01
,
[
1
,
0
,
0
,
1.
])
createPtBox
(
r
.
client
.
gui
,
0
,
res
[
2
][
0
],
0.01
,
[
1
,
0
,
0
,
1.
])
found
=
False
for
j
in
range
(
1
):
res
=
test
(
i
,
True
,
True
,
ine_curve
,
num_optim
)
createPtBox
(
r
.
client
.
gui
,
0
,
res
[
1
][
0
],
0.01
,
[
0
,
1
,
0
,
1.
])
createPtBox
(
r
.
client
.
gui
,
0
,
res
[
2
][
0
],
0.01
,
[
0
,
1
,
0
,
1.
])
if
res
[
0
]:
break
if
not
res
[
0
]:
n_fail
+=
1
print
"
n_fail
"
,
n_fail
a
=
gen_trajectory_to_play
(
fullBody
,
pp
,
allpaths
,
flatten
([[
s
*
0.3
,
s
*
0.6
,
s
*
0.1
]
for
_
in
range
(
len
(
allpaths
)
/
3
)]))
return
a
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