Skip to content
GitLab
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
d82946b0
Verified
Commit
d82946b0
authored
Oct 02, 2020
by
Justin Carpentier
Browse files
python: minor refactoring of Joint exposers
parent
a97adba1
Changes
3
Hide whitespace changes
Inline
Side-by-side
bindings/python/multibody/joint/expose-joints.cpp
View file @
d82946b0
...
...
@@ -16,11 +16,11 @@ namespace pinocchio
static
void
exposeVariants
()
{
boost
::
mpl
::
for_each
<
JointModelVariant
::
types
>
(
ModelExposer
());
boost
::
mpl
::
for_each
<
JointModelVariant
::
types
>
(
Joint
ModelExposer
());
bp
::
to_python_converter
<
pinocchio
::
JointModelVariant
,
JointVariantVisitor
<
pinocchio
::
JointModelVariant
>
>
();
boost
::
mpl
::
for_each
<
JointDataVariant
::
types
>
(
DataExposer
());
boost
::
mpl
::
for_each
<
JointDataVariant
::
types
>
(
Joint
DataExposer
());
bp
::
to_python_converter
<
pinocchio
::
JointDataVariant
,
JointVariantVisitor
<
pinocchio
::
JointDataVariant
>
>
();
}
...
...
bindings/python/multibody/joint/joint-derived.hpp
View file @
d82946b0
//
// Copyright (c) 2015
CNRS
// Copyright (c) 2015
-2020 CNRS INRIA
//
#ifndef __pinocchio_python_joint_
dense
_hpp__
#define __pinocchio_python_joint_
dense
_hpp__
#ifndef __pinocchio_python_joint_
variants
_hpp__
#define __pinocchio_python_joint_
variants
_hpp__
#include
<boost/python.hpp>
#include
<eigenpy/exception.hpp>
...
...
@@ -27,27 +27,29 @@ namespace pinocchio
{
cl
// All are add_properties cause ReadOnly
.
add_property
(
"id"
,
&
JointModelDerivedPythonVisitor
::
getI
d
)
.
add_property
(
"idx_q"
,
&
JointModelDerivedPythonVisitor
::
getI
dx_q
)
.
add_property
(
"idx_v"
,
&
JointModelDerivedPythonVisitor
::
getI
dx_v
)
.
add_property
(
"nq"
,
&
JointModelDerivedPythonVisitor
::
getN
q
)
.
add_property
(
"nv"
,
&
JointModelDerivedPythonVisitor
::
getN
v
)
.
add_property
(
"id"
,
&
get_i
d
)
.
add_property
(
"idx_q"
,
&
get_i
dx_q
)
.
add_property
(
"idx_v"
,
&
get_i
dx_v
)
.
add_property
(
"nq"
,
&
get_n
q
)
.
add_property
(
"nv"
,
&
get_n
v
)
.
def
(
"setIndexes"
,
&
JointModelDerived
::
setIndexes
)
.
def
(
"shortname"
,
&
JointModelDerived
::
shortname
)
;
}
static
JointIndex
getId
(
const
JointModelDerived
&
self
)
{
return
self
.
id
();
}
static
int
getIdx_q
(
const
JointModelDerived
&
self
)
{
return
self
.
idx_q
();}
static
int
getIdx_v
(
const
JointModelDerived
&
self
)
{
return
self
.
idx_v
();}
static
int
getNq
(
const
JointModelDerived
&
self
)
{
return
self
.
nq
();}
static
int
getNv
(
const
JointModelDerived
&
self
)
{
return
self
.
nv
();}
static
JointIndex
get_id
(
const
JointModelDerived
&
self
)
{
return
self
.
id
();
}
static
int
get_idx_q
(
const
JointModelDerived
&
self
)
{
return
self
.
idx_q
();
}
static
int
get_idx_v
(
const
JointModelDerived
&
self
)
{
return
self
.
idx_v
();
}
static
int
get_nq
(
const
JointModelDerived
&
self
)
{
return
self
.
nq
();
}
static
int
get_nv
(
const
JointModelDerived
&
self
)
{
return
self
.
nv
();
}
static
void
expose
()
{
}
{}
};
...
...
@@ -62,42 +64,37 @@ namespace pinocchio
{
cl
// All are add_properties cause ReadOnly
.
add_property
(
"S"
,
&
JointDataDerivedPythonVisitor
::
getS
)
.
add_property
(
"M"
,
&
JointDataDerivedPythonVisitor
::
getM
)
.
add_property
(
"v"
,
&
JointDataDerivedPythonVisitor
::
getv
)
.
add_property
(
"c"
,
&
JointDataDerivedPythonVisitor
::
getc
)
.
add_property
(
"U"
,
&
JointDataDerivedPythonVisitor
::
getU
)
.
add_property
(
"Dinv"
,
&
JointDataDerivedPythonVisitor
::
getDinv
)
.
add_property
(
"UDinv"
,
&
JointDataDerivedPythonVisitor
::
getUDinv
)
.
add_property
(
"S"
,
&
get
_
S
)
.
add_property
(
"M"
,
&
get
_
M
)
.
add_property
(
"v"
,
&
get
_
v
)
.
add_property
(
"c"
,
&
get
_
c
)
.
add_property
(
"U"
,
&
get
_
U
)
.
add_property
(
"Dinv"
,
&
get
_
Dinv
)
.
add_property
(
"UDinv"
,
&
get
_
UDinv
)
.
def
(
"shortname"
,
&
JointDataDerived
::
shortname
)
;
}
static
typename
JointDataDerived
::
Constraint_t
getS
(
const
JointDataDerived
&
self
)
static
typename
JointDataDerived
::
Constraint_t
get
_
S
(
const
JointDataDerived
&
self
)
{
return
self
.
S_accessor
();
}
static
typename
JointDataDerived
::
Transformation_t
getM
(
const
JointDataDerived
&
self
)
static
typename
JointDataDerived
::
Transformation_t
get
_
M
(
const
JointDataDerived
&
self
)
{
return
self
.
M_accessor
();
}
static
typename
JointDataDerived
::
Motion_t
getv
(
const
JointDataDerived
&
self
)
static
typename
JointDataDerived
::
Motion_t
get
_
v
(
const
JointDataDerived
&
self
)
{
return
self
.
v_accessor
();
}
static
typename
JointDataDerived
::
Bias_t
getc
(
const
JointDataDerived
&
self
)
static
typename
JointDataDerived
::
Bias_t
get
_
c
(
const
JointDataDerived
&
self
)
{
return
self
.
c_accessor
();
}
static
typename
JointDataDerived
::
U_t
getU
(
const
JointDataDerived
&
self
)
static
typename
JointDataDerived
::
U_t
get
_
U
(
const
JointDataDerived
&
self
)
{
return
self
.
U_accessor
();
}
static
typename
JointDataDerived
::
D_t
getDinv
(
const
JointDataDerived
&
self
)
static
typename
JointDataDerived
::
D_t
get
_
Dinv
(
const
JointDataDerived
&
self
)
{
return
self
.
Dinv_accessor
();
}
static
typename
JointDataDerived
::
UD_t
getUDinv
(
const
JointDataDerived
&
self
)
static
typename
JointDataDerived
::
UD_t
get
_
UDinv
(
const
JointDataDerived
&
self
)
{
return
self
.
UDinv_accessor
();
}
static
void
expose
()
{
}
{}
};
}}
// namespace pinocchio::python
#endif // ifndef __pinocchio_python_joint_dense_hpp__
#endif // ifndef __pinocchio_python_joint_variants_hpp__
bindings/python/multibody/joint/joints-variant.hpp
View file @
d82946b0
...
...
@@ -33,7 +33,7 @@ namespace pinocchio
}
};
struct
DataExposer
struct
Joint
DataExposer
{
template
<
class
T
>
void
operator
()(
T
)
...
...
@@ -49,7 +49,7 @@ namespace pinocchio
}
};
struct
ModelExposer
struct
Joint
ModelExposer
{
template
<
class
T
>
void
operator
()(
T
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment