Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pinocchio
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
Stack Of Tasks
pinocchio
Commits
73ce9e3f
Commit
73ce9e3f
authored
7 years ago
by
jcarpent
Browse files
Options
Downloads
Patches
Plain Diff
[Bench] Add bench for derivatives algo
parent
fb181398
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
benchmark/CMakeLists.txt
+4
-1
4 additions, 1 deletion
benchmark/CMakeLists.txt
benchmark/timings-derivatives.cpp
+85
-0
85 additions, 0 deletions
benchmark/timings-derivatives.cpp
with
89 additions
and
1 deletion
benchmark/CMakeLists.txt
+
4
−
1
View file @
73ce9e3f
...
...
@@ -42,9 +42,12 @@ ENDMACRO(ADD_TEST_CFLAGS)
#
ADD_BENCH
(
timings TRUE
)
# timings
-eigen
# timings
derivatives
#
ADD_BENCH
(
timings-derivatives TRUE
)
TARGET_LINK_LIBRARIES
(
timings-derivatives
${
PROJECT_NAME
}
)
# timings-eigen
#
ADD_BENCH
(
timings-eigen
)
...
...
This diff is collapsed.
Click to expand it.
benchmark/timings-derivatives.cpp
0 → 100644
+
85
−
0
View file @
73ce9e3f
//
// Copyright (c) 2018 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// Pinocchio is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// Pinocchio If not, see
// <http://www.gnu.org/licenses/>.
#include
"pinocchio/spatial/fwd.hpp"
#include
"pinocchio/spatial/se3.hpp"
#include
"pinocchio/multibody/visitor.hpp"
#include
"pinocchio/multibody/model.hpp"
#include
"pinocchio/algorithm/rnea-derivatives.hpp"
#include
"pinocchio/parsers/urdf.hpp"
#include
"pinocchio/parsers/sample-models.hpp"
#include
"pinocchio/container/aligned-vector.hpp"
#include
<iostream>
#include
"pinocchio/tools/timer.hpp"
int
main
(
int
argc
,
const
char
**
argv
)
{
using
namespace
Eigen
;
using
namespace
se3
;
StackTicToc
timer
(
StackTicToc
::
US
);
#ifdef NDEBUG
const
int
NBT
=
1000
*
100
;
#else
const
int
NBT
=
1
;
std
::
cout
<<
"(the time score in debug mode is not relevant) "
<<
std
::
endl
;
#endif
Model
model
;
std
::
string
filename
=
PINOCCHIO_SOURCE_DIR
"/models/simple_humanoid.urdf"
;
if
(
argc
>
1
)
filename
=
argv
[
1
];
if
(
filename
==
"HS"
)
buildModels
::
humanoidSimple
(
model
,
true
);
else
if
(
filename
==
"H2"
)
buildModels
::
humanoid2d
(
model
);
else
se3
::
urdf
::
buildModel
(
filename
,
JointModelFreeFlyer
(),
model
);
std
::
cout
<<
"nq = "
<<
model
.
nq
<<
std
::
endl
;
std
::
cout
<<
"nv = "
<<
model
.
nv
<<
std
::
endl
;
Data
data
(
model
);
VectorXd
q
=
VectorXd
::
Random
(
model
.
nq
);
VectorXd
qdot
=
VectorXd
::
Random
(
model
.
nv
);
VectorXd
qddot
=
VectorXd
::
Random
(
model
.
nv
);
container
::
aligned_vector
<
VectorXd
>
qs
(
NBT
);
container
::
aligned_vector
<
VectorXd
>
qdots
(
NBT
);
container
::
aligned_vector
<
VectorXd
>
qddots
(
NBT
);
for
(
size_t
i
=
0
;
i
<
NBT
;
++
i
)
{
qs
[
i
]
=
Eigen
::
VectorXd
::
Random
(
model
.
nq
);
qs
[
i
].
segment
<
4
>
(
3
)
/=
qs
[
i
].
segment
<
4
>
(
3
).
norm
();
qdots
[
i
]
=
Eigen
::
VectorXd
::
Random
(
model
.
nv
);
qddots
[
i
]
=
Eigen
::
VectorXd
::
Random
(
model
.
nv
);
}
MatrixXd
drnea_dq
(
MatrixXd
::
Zero
(
model
.
nv
,
model
.
nv
));
MatrixXd
drnea_dv
(
MatrixXd
::
Zero
(
model
.
nv
,
model
.
nv
));
timer
.
tic
();
SMOOTH
(
NBT
)
{
computeRNEADerivatives
(
model
,
data
,
qs
[
_smooth
],
qdots
[
_smooth
],
qddots
[
_smooth
],
drnea_dq
,
drnea_dv
);
}
std
::
cout
<<
"RNEA derivatives=
\t\t
"
;
timer
.
toc
(
std
::
cout
,
NBT
);
std
::
cout
<<
"--"
<<
std
::
endl
;
return
0
;
}
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