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
10c5bcab
Commit
10c5bcab
authored
5 years ago
by
Gabriele Buondonno
Browse files
Options
Downloads
Patches
Plain Diff
[bindings] Expose rotate
parent
bd34591c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/python/math/expose-rpy.cpp
+24
-0
24 additions, 0 deletions
bindings/python/math/expose-rpy.cpp
with
24 additions
and
0 deletions
bindings/python/math/expose-rpy.cpp
+
24
−
0
View file @
10c5bcab
...
...
@@ -23,6 +23,24 @@ namespace pinocchio
return
pinocchio
::
rpy
::
matrixToRpy
(
R
);
}
Eigen
::
Matrix3d
rotate
(
const
std
::
string
axis
,
const
double
ang
)
{
if
(
axis
.
length
()
!=
1U
)
throw
std
::
invalid_argument
(
std
::
string
(
"Invalid axis: "
).
append
(
axis
));
Eigen
::
Vector3d
u
;
u
.
setZero
();
const
char
axis_
=
axis
[
0
];
switch
(
axis_
)
{
case
'x'
:
u
[
0
]
=
1.
;
break
;
case
'y'
:
u
[
1
]
=
1.
;
break
;
case
'z'
:
u
[
2
]
=
1.
;
break
;
default:
throw
std
::
invalid_argument
(
std
::
string
(
"Invalid axis: "
).
append
(
1U
,
axis_
));
}
return
Eigen
::
AngleAxisd
(
ang
,
u
).
matrix
();
}
void
exposeRpy
()
{
using
namespace
Eigen
;
...
...
@@ -51,6 +69,12 @@ namespace pinocchio
" where R_a(theta) denotes the rotation of theta degrees axis a."
" The angles are guaranteed to be in the ranges: r in [-pi,pi],"
" p in[-pi/2,pi/2], y in [-pi,pi]"
);
bp
::
def
(
"rotate"
,
&
rotate
,
bp
::
args
(
"axis"
,
"ang"
),
"Transformation Matrix corresponding to a rotation about x, y or z"
" e.g. R = rot('x', pi / 4): rotate pi/4 rad about x axis"
);
}
}
...
...
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