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
d36be5a7
Commit
d36be5a7
authored
2 years ago
by
Pierre-Alexandre Leziart
Browse files
Options
Downloads
Patches
Plain Diff
Start commenting
parent
ed4d17ab
No related branches found
No related tags found
1 merge request
!32
Draft: Reverse-merge casadi-walking into new WBC devel branch
Pipeline
#24443
failed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/quadruped_reactive_walking/WB_MPC/CasadiOCP.py
+48
-16
48 additions, 16 deletions
python/quadruped_reactive_walking/WB_MPC/CasadiOCP.py
with
48 additions
and
16 deletions
python/quadruped_reactive_walking/WB_MPC/CasadiOCP.py
+
48
−
16
View file @
d36be5a7
...
...
@@ -11,31 +11,63 @@ import pinocchio.casadi as cpin
class
NodeData
:
"""
Data stored by each shooting node of the OCP
Attributes:
x (vector): State vector (q + dq)
cost (float): Cost for this node
isTerminal (bool): True if last node of shooting problem
a (vector): Acceleration slack variables (ddq)
u (vector): Control vector (tau)
f (vector): Contact forces
xnext (vector): Next state vector
"""
def
__init__
(
self
,
isTerminal
=
False
):
self
.
x
=
None
# State vector (q + dq)
self
.
cost
=
None
# Cost for this node
self
.
isTerminal
=
isTerminal
# True if last node of shooting problem
self
.
x
=
None
self
.
cost
=
None
self
.
isTerminal
=
isTerminal
if
not
isTerminal
:
self
.
a
=
None
# Acceleration slack variables (ddq)
self
.
u
=
None
# Control vector (tau)
self
.
f
=
None
# Contact forces
self
.
xnext
=
None
# Next state vector
self
.
a
=
None
self
.
u
=
None
self
.
f
=
None
self
.
xnext
=
None
class
OcpResult
:
"""
Result of the OCP
Attributes:
xs (vector): State trajectory (q + dq)
a (vector): Acceleration trajectory (ddq)
us (vector): Control trajectory (tau)
fs (vector): Contact forces trajectories
"""
def
__init__
(
self
):
self
.
xs
=
None
# State trajectory (q + dq)
self
.
a
=
None
# Acceleration trajectory (ddq)
self
.
us
=
None
# Control trajectory (tau)
self
.
fs
=
None
# Contact forces trajectories
# self.K = None
# self.f_world = None
# self.q = None
# self.v = None
# self.solver_time = None
self
.
xs
=
None
self
.
a
=
None
self
.
us
=
None
self
.
fs
=
None
class
OCP
:
"""
Optimal Control Problem
Args:
pd (ProblemData): data related to the OCP
gait (list): list of list containing contact pattern i.e. for two steps[[1,1,1,1], [1,0,0,1]]
Its length determines the horizon of the ocp
Attributes:
pd (ProblemData): data related to the OCP
results (OcpResult): result of the OCP
shooting_nodes (set): set of shooting nodes of the OCP
"""
def
__init__
(
self
,
pd
:
ProblemData
,
tasks
,
gait
):
"""
Define an optimal ocntrol problem.
:param robot: Pinocchio RobotWrapper instance
...
...
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