Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
pinocchio
Commits
b9fc095c
Unverified
Commit
b9fc095c
authored
Nov 23, 2019
by
Justin Carpentier
Committed by
GitHub
Nov 23, 2019
Browse files
Merge pull request #963 from jcarpent/devel
Fix some bugs in Python unit tests in debug mode
parents
a5120722
6329b46c
Changes
7
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
b9fc095c
...
...
@@ -61,7 +61,8 @@ robotpkg-pinocchio-18.04-debug:
script
:
-
mkdir -p ccache
-
cd /root/robotpkg/math
-
git pull
-
git fetch
-
git reset --hard origin/master
-
cd pinocchio
-
make checkout MASTER_REPOSITORY="git ${CI_PROJECT_DIR}/.git"
-
cd ..
...
...
bindings/python/multibody/model.hpp
View file @
b9fc095c
...
...
@@ -66,15 +66,20 @@ namespace pinocchio
throw
eigenpy
::
Exception
(
"Pickle was not able to reconstruct the model from the loaded data.
\n
"
"The pickle data structure contains too many elements."
);
}
bp
::
object
py_obj
=
tup
[
0
];
if
(
!
PyString_Check
(
py_obj
.
ptr
()))
boost
::
python
::
extract
<
std
::
string
>
obj_as_string
(
py_obj
.
ptr
());
if
(
obj_as_string
.
check
())
{
const
std
::
string
str
=
obj_as_string
;
model
.
loadFromString
(
str
);
}
else
{
throw
eigenpy
::
Exception
(
"Pickle was not able to reconstruct the model from the loaded data.
\n
"
"The entry is not a string."
);
}
const
std
::
string
str
(
PyString_AsString
(
py_obj
.
ptr
()));
model
.
loadFromString
(
str
);
}
};
...
...
package.xml
View file @
b9fc095c
<?xml version="1.0"?>
<package
format=
"2"
>
<name>
pinocchio
</name>
<version>
2.
1.11
</version>
<version>
2.
2.0
</version>
<description>
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives.
</description>
<!-- The maintainer listed here is for the ROS release to receive emails for the buildfarm.
Please check the repository URL for full list of authors and maintainers. -->
...
...
unittest/centroidal.cpp
View file @
b9fc095c
//
// Copyright (c) 2015-201
8
CNRS INRIA
// Copyright (c) 2015-201
9
CNRS INRIA
//
#include "pinocchio/multibody/model.hpp"
#include "pinocchio/multibody/data.hpp"
#include "pinocchio/algorithm/crba.hpp"
#include "pinocchio/algorithm/centroidal.hpp"
#include "pinocchio/algorithm/rnea.hpp"
#include "pinocchio/algorithm/jacobian.hpp"
#include "pinocchio/algorithm/center-of-mass.hpp"
#include "pinocchio/algorithm/joint-configuration.hpp"
#include "pinocchio/parsers/sample-models.hpp"
#include "pinocchio/utils/timer.hpp"
#include <iostream>
...
...
@@ -32,7 +32,7 @@ static void addJointAndBody(pinocchio::Model & model,
Model
::
JointIndex
idx
;
if
(
setRandomLimits
)
if
(
setRandomLimits
)
idx
=
model
.
addJoint
(
model
.
getJointId
(
parent_name
),
joint
,
SE3
::
Random
(),
name
+
"_joint"
,
...
...
@@ -41,15 +41,15 @@ static void addJointAndBody(pinocchio::Model & model,
CV
::
Random
()
-
CV
::
Constant
(
1
),
CV
::
Random
()
+
CV
::
Constant
(
1
)
);
else
idx
=
model
.
addJoint
(
model
.
getJointId
(
parent_name
),
joint
,
placement
,
name
+
"_joint"
);
model
.
addJointFrame
(
idx
);
model
.
appendBodyToJoint
(
idx
,
Inertia
::
Random
(),
SE3
::
Identity
());
model
.
addBodyFrame
(
name
+
"_body"
,
idx
);
}
else
idx
=
model
.
addJoint
(
model
.
getJointId
(
parent_name
),
joint
,
placement
,
name
+
"_joint"
);
model
.
addJointFrame
(
idx
);
model
.
appendBodyToJoint
(
idx
,
Inertia
::
Random
(),
SE3
::
Identity
());
model
.
addBodyFrame
(
name
+
"_body"
,
idx
);
}
BOOST_AUTO_TEST_SUITE
(
BOOST_TEST_MODULE
)
...
...
@@ -104,7 +104,6 @@ BOOST_AUTO_TEST_CASE (test_dccrb)
crba
(
model
,
data_ref
,
q
);
data_ref
.
M
.
triangularView
<
Eigen
::
StrictlyLower
>
()
=
data_ref
.
M
.
transpose
().
triangularView
<
Eigen
::
StrictlyLower
>
();
SE3
::
Vector3
com
=
data_ref
.
Ycrb
[
1
].
lever
();
SE3
cMo
(
SE3
::
Identity
());
cMo
.
translation
()
=
-
getComFromCrba
(
model
,
data_ref
);
...
...
unittest/crba.cpp
View file @
b9fc095c
//
// Copyright (c) 2015-201
8
CNRS
// Copyright (c) 2015-201
9
CNRS
INRIA
//
/*
...
...
@@ -49,15 +49,15 @@ static void addJointAndBody(pinocchio::Model & model,
CV
::
Random
()
-
CV
::
Constant
(
1
),
CV
::
Random
()
+
CV
::
Constant
(
1
)
);
else
idx
=
model
.
addJoint
(
model
.
getJointId
(
parent_name
),
joint
,
placement
,
name
+
"_joint"
);
model
.
addJointFrame
(
idx
);
model
.
appendBodyToJoint
(
idx
,
Inertia
::
Random
(),
SE3
::
Identity
());
model
.
addBodyFrame
(
name
+
"_body"
,
idx
);
}
else
idx
=
model
.
addJoint
(
model
.
getJointId
(
parent_name
),
joint
,
placement
,
name
+
"_joint"
);
model
.
addJointFrame
(
idx
);
model
.
appendBodyToJoint
(
idx
,
Inertia
::
Random
(),
SE3
::
Identity
());
model
.
addBodyFrame
(
name
+
"_body"
,
idx
);
}
BOOST_AUTO_TEST_SUITE
(
BOOST_TEST_MODULE
)
...
...
unittest/eigen-tensor.cpp
View file @
b9fc095c
...
...
@@ -14,7 +14,8 @@ BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
BOOST_AUTO_TEST_CASE
(
test_emulate_tensors
)
{
typedef
pinocchio
::
Tensor
<
double
,
3
>
Tensor
;
typedef
double
Scalar
;
typedef
pinocchio
::
Tensor
<
Scalar
,
3
>
Tensor
;
const
Eigen
::
DenseIndex
x_dim
=
6
,
y_dim
=
20
,
z_dim
=
20
;
Tensor
tensor1
(
x_dim
,
y_dim
,
z_dim
);
...
...
@@ -24,9 +25,9 @@ BOOST_AUTO_TEST_CASE(test_emulate_tensors)
BOOST_CHECK
(
tensor1
.
dimension
(
1
)
==
y_dim
);
BOOST_CHECK
(
tensor1
.
dimension
(
2
)
==
z_dim
);
double
*
data
=
tensor1
.
data
();
Scalar
*
data
=
tensor1
.
data
();
for
(
Eigen
::
DenseIndex
k
=
0
;
k
<
tensor1
.
size
();
++
k
)
data
[
k
]
=
k
;
data
[
k
]
=
(
Scalar
)
k
;
for
(
Eigen
::
DenseIndex
k
=
0
;
k
<
z_dim
;
++
k
)
{
...
...
@@ -34,7 +35,7 @@ BOOST_AUTO_TEST_CASE(test_emulate_tensors)
{
for
(
Eigen
::
DenseIndex
i
=
0
;
i
<
x_dim
;
++
i
)
{
BOOST_CHECK
(
tensor1
(
i
,
j
,
k
)
==
i
+
j
*
x_dim
+
k
*
(
x_dim
*
y_dim
));
BOOST_CHECK
(
tensor1
(
i
,
j
,
k
)
==
(
Scalar
)(
i
+
j
*
x_dim
+
k
*
(
x_dim
*
y_dim
))
)
;
}
}
}
...
...
unittest/python/bindings_model.py
View file @
b9fc095c
...
...
@@ -12,9 +12,13 @@ class TestModel(TestCase):
import
pickle
model
=
self
.
model
pickle
.
dump
(
model
,
open
(
"save.p"
,
"wb"
)
)
filename
=
"model.pickle"
with
open
(
filename
,
'wb'
)
as
f
:
pickle
.
dump
(
model
,
f
)
model_copy
=
pickle
.
load
(
open
(
"save.p"
,
"rb"
)
)
with
open
(
filename
,
'rb'
)
as
f
:
model_copy
=
pickle
.
load
(
f
)
self
.
assertTrue
(
model
==
model_copy
)
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment