Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Q
quadruped-reactive-walking
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
Gepetto
quadruped-reactive-walking
Commits
2ce10c51
Commit
2ce10c51
authored
2 years ago
by
Fanny Risbourg
Browse files
Options
Downloads
Patches
Plain Diff
add benchmark file
parent
8835f78f
No related branches found
No related tags found
1 merge request
!28
Benchmark ale
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/quadruped_reactive_walking/Controller.py
+1
-0
1 addition, 0 deletions
python/quadruped_reactive_walking/Controller.py
python/quadruped_reactive_walking/WB_MPC/BenchmarkCrocoddylOCP.py
+98
-0
98 additions, 0 deletions
...uadruped_reactive_walking/WB_MPC/BenchmarkCrocoddylOCP.py
with
99 additions
and
0 deletions
python/quadruped_reactive_walking/Controller.py
+
1
−
0
View file @
2ce10c51
...
@@ -91,6 +91,7 @@ class Controller:
...
@@ -91,6 +91,7 @@ class Controller:
m
=
self
.
read_state
(
device
)
m
=
self
.
read_state
(
device
)
print
(
m
[
'
x_m
'
])
try
:
try
:
#self.mpc.solve(self.k, m['x_m'], self.guess) # Closed loop mpc
#self.mpc.solve(self.k, m['x_m'], self.guess) # Closed loop mpc
...
...
This diff is collapsed.
Click to expand it.
python/quadruped_reactive_walking/WB_MPC/BenchmarkCrocoddylOCP.py
0 → 100644
+
98
−
0
View file @
2ce10c51
import
quadruped_reactive_walking
as
qrw
from
.CrocoddylOCP
import
OCP
from
.ProblemData
import
ProblemData
,
ProblemDataFull
from
.Target
import
Target
import
crocoddyl
import
pinocchio
import
example_robot_data
import
numpy
as
np
import
sys
import
time
T
=
int
(
sys
.
argv
[
1
])
if
(
len
(
sys
.
argv
)
>
1
)
else
int
(
5e3
)
# number of trials
MAXITER
=
1
GAIT
=
"
walking
"
# 55 nodes
def
createProblem
():
params
=
qrw
.
Params
()
pd
=
ProblemData
(
params
)
target
=
Target
(
pd
)
target
.
update
(
0
)
OCP
=
OCP
(
pd
,
target
)
problem
=
OCP
.
make_ocp
(
x0
)
xs
=
[
robot_model
.
defaultState
]
*
(
len
(
problem
.
runningModels
)
+
1
)
us
=
[
m
.
quasiStatic
(
d
,
robot_model
.
defaultState
)
for
m
,
d
in
list
(
zip
(
problem
.
runningModels
,
problem
.
runningDatas
))]
return
xs
,
us
,
problem
def
runDDPSolveBenchmark
(
xs
,
us
,
problem
):
ddp
=
crocoddyl
.
SolverDDP
(
problem
)
duration
=
[]
for
_
in
range
(
T
):
c_start
=
time
.
time
()
ddp
.
solve
(
xs
,
us
,
MAXITER
,
False
,
0.1
)
c_end
=
time
.
time
()
duration
.
append
(
1e3
*
(
c_end
-
c_start
))
avrg_duration
=
sum
(
duration
)
/
len
(
duration
)
min_duration
=
min
(
duration
)
max_duration
=
max
(
duration
)
return
avrg_duration
,
min_duration
,
max_duration
def
runShootingProblemCalcBenchmark
(
xs
,
us
,
problem
):
duration
=
[]
for
_
in
range
(
T
):
c_start
=
time
.
time
()
problem
.
calc
(
xs
,
us
)
c_end
=
time
.
time
()
duration
.
append
(
1e3
*
(
c_end
-
c_start
))
avrg_duration
=
sum
(
duration
)
/
len
(
duration
)
min_duration
=
min
(
duration
)
max_duration
=
max
(
duration
)
return
avrg_duration
,
min_duration
,
max_duration
def
runShootingProblemCalcDiffBenchmark
(
xs
,
us
,
problem
):
duration
=
[]
for
_
in
range
(
T
):
c_start
=
time
.
time
()
problem
.
calcDiff
(
xs
,
us
)
c_end
=
time
.
time
()
duration
.
append
(
1e3
*
(
c_end
-
c_start
))
avrg_duration
=
sum
(
duration
)
/
len
(
duration
)
min_duration
=
min
(
duration
)
max_duration
=
max
(
duration
)
return
avrg_duration
,
min_duration
,
max_duration
# Setting up all tasks
if
GAIT
==
'
walking
'
:
GAITPHASE
=
{
'
walking
'
:
{
'
stepLength
'
:
0.6
,
'
stepHeight
'
:
0.1
,
'
timeStep
'
:
0.0375
,
'
stepKnots
'
:
25
,
'
supportKnots
'
:
1
}
}
print
(
'
\033
[1m
'
)
print
(
'
Python bindings:
'
)
xs
,
us
,
problem
=
createProblem
(
GAITPHASE
)
avrg_duration
,
min_duration
,
max_duration
=
runDDPSolveBenchmark
(
xs
,
us
,
problem
)
print
(
'
DDP.solve [ms]: {0} ({1}, {2})
'
.
format
(
avrg_duration
,
min_duration
,
max_duration
))
avrg_duration
,
min_duration
,
max_duration
=
runShootingProblemCalcBenchmark
(
xs
,
us
,
problem
)
print
(
'
ShootingProblem.calc [ms]: {0} ({1}, {2})
'
.
format
(
avrg_duration
,
min_duration
,
max_duration
))
avrg_duration
,
min_duration
,
max_duration
=
runShootingProblemCalcDiffBenchmark
(
xs
,
us
,
problem
)
print
(
'
ShootingProblem.calcDiff [ms]: {0} ({1}, {2})
'
.
format
(
avrg_duration
,
min_duration
,
max_duration
))
print
(
'
\033
[0m
'
)
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