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
cd8f247d
Commit
cd8f247d
authored
7 years ago
by
jcarpent
Browse files
Options
Downloads
Patches
Plain Diff
[Algo] Change normalize algo to directly work with LieGroups
parent
dcdc5f72
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/algorithm/joint-configuration.hpp
+10
-0
10 additions, 0 deletions
src/algorithm/joint-configuration.hpp
src/algorithm/joint-configuration.hxx
+28
-14
28 additions, 14 deletions
src/algorithm/joint-configuration.hxx
unittest/joint-configurations.cpp
+5
-5
5 additions, 5 deletions
unittest/joint-configurations.cpp
with
43 additions
and
19 deletions
src/algorithm/joint-configuration.hpp
+
10
−
0
View file @
cd8f247d
...
...
@@ -116,6 +116,16 @@ namespace se3
template
<
typename
LieGroup_t
>
inline
Eigen
::
VectorXd
randomConfiguration
(
const
Model
&
model
);
/**
* @brief Normalize a configuration
*
* @param[in] model Model
* @param[in,out] q Configuration to normalize
*/
template
<
typename
LieGroup_t
>
inline
void
normalize
(
const
Model
&
model
,
Eigen
::
VectorXd
&
q
);
/**
* @brief Normalize a configuration
*
...
...
This diff is collapsed.
Click to expand it.
src/algorithm/joint-configuration.hxx
+
28
−
14
View file @
cd8f247d
...
...
@@ -390,31 +390,45 @@ namespace se3
{
return
randomConfiguration
<
LieGroupTpl
>
(
model
);
}
struct
NormalizeStep
:
public
fusion
::
JointModelVisitor
<
NormalizeStep
>
template
<
typename
LieGroup_t
,
typename
JointModel
>
struct
NormalizeStepAlgo
;
template
<
typename
LieGroup_t
>
struct
NormalizeStep
:
public
fusion
::
JointModelVisitor
<
NormalizeStep
<
LieGroup_t
>
>
{
typedef
boost
::
fusion
::
vector
<
Eigen
::
VectorXd
&>
ArgsType
;
JOINT_MODEL_VISITOR_INIT
(
NormalizeStep
);
template
<
typename
JointModel
>
static
void
algo
(
const
se3
::
JointModelBase
<
JointModel
>
&
jmodel
,
Eigen
::
VectorXd
&
q
)
SE3_DETAILS_VISITOR_METHOD_ALGO_1
(
NormalizeStepAlgo
,
LieGroup_t
)
};
template
<
typename
LieGroup_t
,
typename
JointModel
>
struct
NormalizeStepAlgo
{
static
void
run
(
const
se3
::
JointModelBase
<
JointModel
>
&
jmodel
,
Eigen
::
VectorXd
&
qout
)
{
jmodel
.
normalize
(
q
);
LieGroup_t
::
template
operation
<
JointModel
>
::
type
::
normalize
(
jmodel
.
jointConfigSelector
(
qout
)
);
}
};
SE3_DETAILS_DISPATCH_JOINT_COMPOSITE_1
(
NormalizeStep
,
NormalizeStepAlgo
);
inline
void
normalize
(
const
Model
&
model
,
Eigen
::
VectorXd
&
q
)
template
<
typename
LieGroup_t
>
inline
void
normalize
(
const
Model
&
model
,
Eigen
::
VectorXd
&
qout
)
{
for
(
Model
::
JointIndex
i
=
1
;
i
<
(
Model
::
JointIndex
)
model
.
njoints
;
++
i
)
for
(
Model
::
JointIndex
i
=
1
;
i
<
(
Model
::
JointIndex
)
model
.
njoints
;
++
i
)
{
NormalizeStep
::
run
(
model
.
joints
[
i
],
NormalizeStep
::
ArgsType
(
q
));
NormalizeStep
<
LieGroup_t
>
::
run
(
model
.
joints
[
i
],
typename
NormalizeStep
<
LieGroup_t
>
::
ArgsType
(
q
out
));
}
}
inline
void
normalize
(
const
Model
&
model
,
Eigen
::
VectorXd
&
qout
)
{
return
normalize
<
LieGroupTpl
>
(
model
,
qout
);
}
template
<
typename
LieGroup_t
,
typename
JointModel
>
struct
IsSameConfigurationStepAlgo
;
...
...
This diff is collapsed.
Click to expand it.
unittest/joint-configurations.cpp
+
5
−
5
View file @
cd8f247d
...
...
@@ -60,13 +60,13 @@ void buildModel(Model & model)
{
addJointAndBody
(
model
,
JointModelFreeFlyer
(),
model
.
getJointId
(
"universe"
),
SE3
::
Identity
(),
"freeflyer"
,
Inertia
::
Random
());
addJointAndBody
(
model
,
JointModelSpherical
(),
model
.
getJointId
(
"freeflyer_joint"
),
SE3
::
Identity
(),
"spherical"
,
Inertia
::
Random
());
addJointAndBody
(
model
,
JointModelRX
(),
model
.
getJointId
(
"spherical_joint"
),
SE3
::
Identity
(),
"rx"
,
Inertia
::
Random
());
addJointAndBody
(
model
,
JointModelPlanar
(),
model
.
getJointId
(
"spherical_joint"
),
SE3
::
Identity
(),
"planar"
,
Inertia
::
Random
());
addJointAndBody
(
model
,
JointModelRX
(),
model
.
getJointId
(
"planar_joint"
),
SE3
::
Identity
(),
"rx"
,
Inertia
::
Random
());
addJointAndBody
(
model
,
JointModelPX
(),
model
.
getJointId
(
"rx_joint"
),
SE3
::
Identity
(),
"px"
,
Inertia
::
Random
());
addJointAndBody
(
model
,
JointModelPrismaticUnaligned
(
SE3
::
Vector3
(
1
,
0
,
0
)),
model
.
getJointId
(
"px_joint"
),
SE3
::
Identity
(),
"pu"
,
Inertia
::
Random
());
addJointAndBody
(
model
,
JointModelRevoluteUnaligned
(
SE3
::
Vector3
(
0
,
0
,
1
)),
model
.
getJointId
(
"pu_joint"
),
SE3
::
Identity
(),
"ru"
,
Inertia
::
Random
());
addJointAndBody
(
model
,
JointModelSphericalZYX
(),
model
.
getJointId
(
"ru_joint"
),
SE3
::
Identity
(),
"sphericalZYX"
,
Inertia
::
Random
());
addJointAndBody
(
model
,
JointModelTranslation
(),
model
.
getJointId
(
"sphericalZYX_joint"
),
SE3
::
Identity
(),
"translation"
,
Inertia
::
Random
());
addJointAndBody
(
model
,
JointModelPlanar
(),
model
.
getJointId
(
"translation_joint"
),
SE3
::
Identity
(),
"planar"
,
Inertia
::
Random
());
}
BOOST_AUTO_TEST_SUITE
(
BOOST_TEST_MODULE
)
...
...
@@ -317,13 +317,13 @@ BOOST_AUTO_TEST_CASE ( neutral_configuration_test )
Eigen
::
VectorXd
expected
(
model
.
nq
);
expected
<<
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
;
0
,
0
,
0
;
BOOST_CHECK_MESSAGE
(
model
.
neutralConfiguration
.
isApprox
(
expected
,
1e-12
),
"neutral configuration - wrong results"
);
...
...
@@ -365,7 +365,7 @@ BOOST_AUTO_TEST_CASE ( normalize_test )
BOOST_CHECK
(
q
.
head
<
3
>
().
isApprox
(
Eigen
::
VectorXd
::
Ones
(
3
)));
BOOST_CHECK
(
fabs
(
q
.
segment
<
4
>
(
3
).
norm
()
-
1
)
<
Eigen
::
NumTraits
<
double
>::
epsilon
());
// quaternion of freeflyer
BOOST_CHECK
(
fabs
(
q
.
segment
<
4
>
(
7
).
norm
()
-
1
)
<
Eigen
::
NumTraits
<
double
>::
epsilon
());
// quaternion of spherical joint
const
int
n
=
model
.
nq
-
7
-
4
;
const
int
n
=
model
.
nq
-
7
-
4
-
4
;
// free flyer + spherical + planar
BOOST_CHECK
(
q
.
tail
(
n
).
isApprox
(
Eigen
::
VectorXd
::
Ones
(
n
)));
}
...
...
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