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
0bbd6364
Commit
0bbd6364
authored
2 years ago
by
cbusato
Browse files
Options
Downloads
Patches
Plain Diff
Switch beack from xs optimization to dxs optimization
parent
d4928374
No related branches found
No related tags found
1 merge request
!32
Draft: Reverse-merge casadi-walking into new WBC devel branch
Pipeline
#26054
failed
2 years ago
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/quadruped_reactive_walking/WB_MPC/CasadiOCP.py
+14
-10
14 additions, 10 deletions
python/quadruped_reactive_walking/WB_MPC/CasadiOCP.py
with
14 additions
and
10 deletions
python/quadruped_reactive_walking/WB_MPC/CasadiOCP.py
+
14
−
10
View file @
0bbd6364
...
...
@@ -163,15 +163,17 @@ class OCP:
print
(
"
-- End of solve() --
"
)
"""
from IPython import embed
embed()
"""
def
my_debug
(
self
,
i
):
print
(
"
---
"
+
str
(
i
)
+
"
---
"
)
for
j
in
range
(
4
):
print
(
self
.
opti
.
debug
.
value
(
self
.
datas
[
0
].
f
[
j
]))
for
cost
in
self
.
datas
[
0
].
costs
:
self
.
log_costs
[
cost
].
append
([
self
.
opti
.
value
(
data
.
costs
[
cost
])
for
data
in
self
.
datas
])
self
.
log_costs
[
cost
].
append
(
[
self
.
opti
.
value
(
data
.
costs
[
cost
])
for
data
in
self
.
datas
]
)
"""
for data in self.datas:
for cost in data.costs:
self.log_costs[cost].append(self.opti.value(data.costs[cost]))
"""
...
...
@@ -210,7 +212,10 @@ class OCP:
]
self
.
acs
=
[
opti
.
variable
(
self
.
pd
.
nv
)
for
_
in
self
.
runningModels
]
self
.
us
=
[
opti
.
variable
(
self
.
pd
.
nu
)
for
_
in
self
.
runningModels
]
self
.
xs
=
[
opti
.
variable
(
self
.
pd
.
nx
)
for
_
in
(
self
.
runningModels
+
[
self
.
terminalModel
])]
self
.
xs
=
[
m
.
integrate
(
x0
,
dx
)
for
m
,
dx
in
zip
(
self
.
runningModels
+
[
self
.
terminalModel
],
self
.
dxs
)
]
self
.
fs
=
[]
for
m
in
self
.
runningModels
:
f_tmp
=
[
opti
.
variable
(
3
)
for
_
in
range
(
len
(
m
.
contactIds
))]
...
...
@@ -234,10 +239,11 @@ class OCP:
eq
=
[]
# First running node is in initial state of the robot
eq
.
append
(
self
.
runningModels
[
0
].
difference
(
self
.
xs
[
0
],
x0
))
# Could also be eq.append(self.dxs[0]) to force first dxs to 0?
# Set targets in xref of ProblemData
self
.
pd
.
xref
[
self
.
pd
.
nq
:
(
self
.
pd
.
nq
+
3
)]
=
targets
[
0
]
self
.
pd
.
xref
[(
self
.
pd
.
nq
+
3
)
:
(
self
.
pd
.
nq
+
6
)]
=
targets
[
1
]
self
.
pd
.
xref
[
self
.
pd
.
nq
:
(
self
.
pd
.
nq
+
3
)]
=
targets
[
0
]
self
.
pd
.
xref
[(
self
.
pd
.
nq
+
3
)
:
(
self
.
pd
.
nq
+
6
)]
=
targets
[
1
]
# Gather costs and equality constraints for each running node
for
t
in
range
(
self
.
pd
.
T
):
...
...
@@ -310,8 +316,8 @@ class OCP:
]
)
for
x
,
xg
in
zip
(
self
.
xs
,
xs_g
):
self
.
opti
.
set_initial
(
x
,
xg
)
for
x
,
xg
in
zip
(
self
.
d
xs
,
xs_g
):
self
.
opti
.
set_initial
(
x
,
xdiff
(
x0
,
xg
)
)
for
a
,
ag
in
zip
(
self
.
acs
,
acs_g
):
self
.
opti
.
set_initial
(
a
,
ag
)
for
u
,
ug
in
zip
(
self
.
us
,
us_g
):
...
...
@@ -324,8 +330,6 @@ class OCP:
print
(
"
Got warm start
"
)
except
:
print
(
"
Can
'
t load warm start
"
)
for
x
in
self
.
xs
:
self
.
opti
.
set_initial
(
x
,
x0
)
def
get_results
(
self
):
xs_sol
=
[
self
.
opti
.
value
(
x
)
for
x
in
self
.
xs
]
...
...
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