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
0db56812
Commit
0db56812
authored
3 years ago
by
odri
Browse files
Options
Downloads
Patches
Plain Diff
Switch from std::vector to Eigen Matrix to avoid runtime in FootTrajectoryGenerator
parent
f5f69600
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#16532
failed
3 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/qrw/FootTrajectoryGenerator.hpp
+1
-1
1 addition, 1 deletion
include/qrw/FootTrajectoryGenerator.hpp
src/FootTrajectoryGenerator.cpp
+24
-18
24 additions, 18 deletions
src/FootTrajectoryGenerator.cpp
with
25 additions
and
19 deletions
include/qrw/FootTrajectoryGenerator.hpp
+
1
−
1
View file @
0db56812
...
@@ -84,7 +84,7 @@ class FootTrajectoryGenerator {
...
@@ -84,7 +84,7 @@ class FootTrajectoryGenerator {
double
lockTime_
;
// Target lock before the touchdown
double
lockTime_
;
// Target lock before the touchdown
double
vertTime_
;
// Duration during which feet move only along Z when taking off and landing
double
vertTime_
;
// Duration during which feet move only along Z when taking off and landing
std
::
vector
<
int
>
feet
;
// Column indexes of feet currently in swing phase
Eigen
::
Matrix
<
int
,
1
,
4
>
feet
;
// Column indexes of feet currently in swing phase
Vector4
t0s
;
// Elapsed time since the start of the swing phase movement
Vector4
t0s
;
// Elapsed time since the start of the swing phase movement
Vector4
t_swing
;
// Swing phase duration for each foot
Vector4
t_swing
;
// Swing phase duration for each foot
...
...
This diff is collapsed.
Click to expand it.
src/FootTrajectoryGenerator.cpp
+
24
−
18
View file @
0db56812
...
@@ -8,7 +8,7 @@ FootTrajectoryGenerator::FootTrajectoryGenerator()
...
@@ -8,7 +8,7 @@ FootTrajectoryGenerator::FootTrajectoryGenerator()
k_mpc
(
0
),
k_mpc
(
0
),
maxHeight_
(
0.0
),
maxHeight_
(
0.0
),
lockTime_
(
0.0
),
lockTime_
(
0.0
),
feet
(),
feet
(
Eigen
::
Matrix
<
int
,
1
,
4
>::
Zero
()
),
t0s
(
Vector4
::
Zero
()),
t0s
(
Vector4
::
Zero
()),
t_swing
(
Vector4
::
Zero
()),
t_swing
(
Vector4
::
Zero
()),
targetFootstep_
(
Matrix34
::
Zero
()),
targetFootstep_
(
Matrix34
::
Zero
()),
...
@@ -183,34 +183,40 @@ void FootTrajectoryGenerator::updateFootPosition(int const j, Vector3 const &tar
...
@@ -183,34 +183,40 @@ void FootTrajectoryGenerator::updateFootPosition(int const j, Vector3 const &tar
void
FootTrajectoryGenerator
::
update
(
int
k
,
MatrixN
const
&
targetFootstep
)
{
void
FootTrajectoryGenerator
::
update
(
int
k
,
MatrixN
const
&
targetFootstep
)
{
if
((
k
%
k_mpc
)
==
0
)
{
if
((
k
%
k_mpc
)
==
0
)
{
// Indexes of feet in swing phase
// Status of feet
feet
.
clear
();
feet
=
gait_
->
getCurrentGait
().
row
(
0
).
cast
<
int
>
();
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
if
(
gait_
->
getCurrentGait
()(
0
,
i
)
==
0
)
feet
.
push_back
(
i
);
}
// If no foot in swing phase
// If no foot in swing phase
if
(
feet
.
s
ize
()
==
0
)
return
;
if
(
feet
.
s
um
()
==
4
)
return
;
// For each foot in swing phase get remaining duration of the swing phase
// For each foot in swing phase get remaining duration of the swing phase
for
(
int
j
=
0
;
j
<
(
int
)
feet
.
size
();
j
++
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
int
i
=
feet
[
j
];
if
(
feet
(
0
,
i
)
==
0
)
t_swing
[
i
]
=
gait_
->
getPhaseDuration
(
0
,
feet
[
j
],
0.0
);
// 0.0 for swing phase
{
double
value
=
t_swing
[
i
]
-
(
gait_
->
getRemainingTime
()
*
k_mpc
-
((
k
+
1
)
%
k_mpc
))
*
dt_wbc
-
dt_wbc
;
t_swing
[
i
]
=
gait_
->
getPhaseDuration
(
0
,
i
,
0.0
);
// 0.0 for swing phase
t0s
[
i
]
=
std
::
max
(
0.0
,
value
);
double
value
=
t_swing
[
i
]
-
(
gait_
->
getRemainingTime
()
*
k_mpc
-
((
k
+
1
)
%
k_mpc
))
*
dt_wbc
-
dt_wbc
;
t0s
[
i
]
=
std
::
max
(
0.0
,
value
);
}
}
}
}
else
{
}
else
{
// If no foot in swing phase
// If no foot in swing phase
if
(
feet
.
s
ize
()
==
0
)
return
;
if
(
feet
.
s
um
()
==
4
)
return
;
// Increment of one time step for feet in swing phase
// Increment of one time step for feet in swing phase
for
(
int
i
=
0
;
i
<
(
int
)
feet
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
double
value
=
t0s
[
feet
[
i
]]
+
dt_wbc
;
if
(
feet
(
0
,
i
)
==
0
)
t0s
[
feet
[
i
]]
=
std
::
max
(
0.0
,
value
);
{
double
value
=
t0s
[
i
]
+
dt_wbc
;
t0s
[
i
]
=
std
::
max
(
0.0
,
value
);
}
}
}
}
}
for
(
int
i
=
0
;
i
<
(
int
)
feet
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
updateFootPosition
(
feet
[
i
],
targetFootstep
.
col
(
feet
[
i
]));
if
(
feet
(
0
,
i
)
==
0
)
{
updateFootPosition
(
i
,
targetFootstep
.
col
(
i
));
}
}
}
return
;
return
;
}
}
...
...
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