-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 859c786
Showing
179 changed files
with
10,358 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 7eae2ec91fd1f4858ea37764f2bface0 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
:github_url: https://github.com/stephane-caron/pink/tree/main/doc/src/developer-notes.rst | ||
|
||
*************** | ||
Developer notes | ||
*************** | ||
|
||
This section documents internal functions and other notes shared between contributors to this project. | ||
|
||
Design guidelines | ||
================= | ||
|
||
* Pink is designed for clarity before performance | ||
* Leaky abstractions are our enemy | ||
* WIP | ||
|
||
Internal functions | ||
================== | ||
|
||
.. automodule:: pink.tasks.utils | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
:github_url: https://github.com/stephane-caron/pink/tree/main/doc/src/index.rst | ||
|
||
.. title:: Table of Contents | ||
|
||
#### | ||
Pink | ||
#### | ||
|
||
.. image:: images/pink-round-corners-140x140.png | ||
:height: 140px | ||
:alt: alternate text | ||
:align: right | ||
|
||
**P**\ ython **in**\ verse **k**\ inematics for articulated robot models, based on `Pinocchio <https://github.com/stack-of-tasks/pinocchio>`_. | ||
|
||
Inverse kinematics in Pink is defined by weighted :ref:`tasks <Tasks>` and :ref:`limits <Limits>`. The library adds a :ref:`configuration <Configuration>` type to Pinocchio, a configuration being a robot model and data to which forward kinematics have been applied. Given a configuration, tasks and a time step, :func:`pink.solve_ik.solve_ik` computes joint velocities that steer the model towards fulfilling all tasks at best. | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
installation.rst | ||
introduction.rst | ||
tasks.rst | ||
limits.rst | ||
inverse-kinematics.rst | ||
developer-notes.rst | ||
references.rst | ||
|
||
You can also download this documentation as a `PDF document <pink.pdf>`_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
:github_url: https://github.com/stephane-caron/pink/tree/main/doc/src/installation.rst | ||
|
||
************ | ||
Installation | ||
************ | ||
|
||
From PyPI | ||
========= | ||
|
||
Installation from the Python Package Index should work via: | ||
|
||
.. code:: bash | ||
pip install pin-pink | ||
From source | ||
=========== | ||
|
||
If installation from PyPI doesn't work, for instance on Raspberry Pi, install the following dependencies from source: | ||
|
||
- `eigenpy <https://github.com/stack-of-tasks/eigenpy>`__ (required by Pinocchio) | ||
- `pinocchio <https://github.com/stack-of-tasks/pinocchio>`__ | ||
|
||
Then install Pink by: | ||
|
||
.. code:: bash | ||
pip install --no-deps pin-pink | ||
Or by copying its source directory somewhere in your ``PYTHONPATH``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
:github_url: https://github.com/stephane-caron/pink/tree/main/doc/src/introduction.rst | ||
|
||
************ | ||
Introduction | ||
************ | ||
|
||
Inverse kinematics (IK) is the problem of computing *motions* (in Pink: velocities) that achieve a given set of *tasks*, such as putting a foot on a surface, moving the center of mass to a target location, etc. | ||
|
||
This documentation assumes you are already familiar with task-based inverse kinematics. You can check out for instance this `note on inverse kinematics <https://scaron.info/robot-locomotion/inverse-kinematics.html>`__ for a general introduction. | ||
|
||
Notations | ||
========= | ||
|
||
In Pink, we adopt the subscript right-to-left convention for transforms, and superscript notation to indicate the frame of a motion or force vector: | ||
|
||
.. list-table:: | ||
:class: cheatsheet | ||
:widths: 70 30 | ||
|
||
* - Quantity | ||
- Notation | ||
* - Affine transform from frame :math:`A` to frame :math:`B` | ||
- :math:`T_{BA}` | ||
* - Body angular velocity of frame :math:`A` in frame :math:`B` | ||
- :math:`{}^A \omega_{BA}` | ||
* - Plücker transform from frame :math:`A` to frame :math:`B` | ||
- :math:`X_{BA}` | ||
* - Position of frame :math:`B` in frame :math:`A` | ||
- :math:`{}^A p_B` | ||
* - Rotation matrix from frame :math:`A` to frame :math:`B` | ||
- :math:`R_{BA}` | ||
* - Spatial angular velocity of frame :math:`A` in frame :math:`B` | ||
- :math:`{}^B \omega_{BA}` | ||
* - World frame (inertial) | ||
- :math:`W` | ||
|
||
With these notations frame transforms can be read left to right, for example: | ||
|
||
.. raw:: latex html | ||
|
||
\begin{align} | ||
X_{CA} & = X_{CB} X_{BA} & | ||
{}^{B} \omega & = R_{BA} {}^{A} \omega & | ||
{}^B p_C & = R_{BA} {}^A p_C + {}^B p_A | ||
\end{align} | ||
|
||
See also this `spatial algebra cheat sheet | ||
<https://scaron.info/robot-locomotion/spatial-vector-algebra-cheat-sheet.html>`_. | ||
|
||
.. _Configuration: | ||
|
||
Configuration | ||
============= | ||
|
||
.. automodule:: pink.configuration | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
:github_url: https://github.com/stephane-caron/pink/tree/main/doc/src/inverse-kinematics.rst | ||
|
||
****************** | ||
Inverse kinematics | ||
****************** | ||
|
||
The main function solve inverse kinematics is :func:`.solve_ik`. Here is for | ||
instance how it appears in a closed-loop inverse kinematics: | ||
|
||
.. code:: python | ||
rate = RateLimiter(frequency=100.0) | ||
while True: | ||
# [...] <- update task targets here | ||
velocity = solve_ik(configuration, tasks, rate.dt, solver=solver) | ||
configuration.integrate_inplace(velocity, rate.dt) | ||
rate.sleep() | ||
See the ``examples/`` folder in the repository for complete use cases. | ||
|
||
.. autofunction:: pink.solve_ik.solve_ik | ||
|
||
It is also possible to ask Pink to only build the underlying inverse kinematics | ||
problem via the :func:`.build_ik` function: | ||
|
||
.. autofunction:: pink.solve_ik.build_ik |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
:github_url: https://github.com/stephane-caron/pink/tree/main/doc/src/limits.rst | ||
|
||
.. _Limits: | ||
|
||
****** | ||
Limits | ||
****** | ||
|
||
.. automodule:: pink.limits | ||
:members: | ||
|
||
Configuration limits | ||
==================== | ||
|
||
.. automodule:: pink.limits.configuration_limit | ||
:members: | ||
|
||
Velocity limits | ||
=============== | ||
|
||
.. automodule:: pink.limits.velocity_limit | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
:github_url: https://github.com/stephane-caron/pink/tree/main/doc/src/references.rst | ||
|
||
********** | ||
References | ||
********** | ||
|
||
.. [FrameTaskJacobian] `Jacobian of a kinematic task and derivatives on manifolds <https://scaron.info/robotics/jacobian-of-a-kinematic-task-and-derivatives-on-manifolds.html>`_. S. Caron. 2023. | ||
.. [MLT] `A micro Lie theory for state estimation in robotics <https://arxiv.org/abs/1812.01537>`_. J. Solà, J. Deray, D. Atchuthan. 2018. | ||
.. [Sugihara2011] *Solvability-Unconcerned Inverse Kinematics by the Levenberg-Marquardt Method*. T. Sugihara. IEEE transactions on robotics, 2011, vol. 27, no 5, p. 984-991. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
:github_url: https://github.com/stephane-caron/pink/tree/main/doc/src/tasks.rst | ||
|
||
.. _Tasks: | ||
|
||
***** | ||
Tasks | ||
***** | ||
|
||
Base task | ||
========= | ||
|
||
.. automodule:: pink.tasks.task | ||
:members: | ||
|
||
Body task | ||
========= | ||
|
||
.. automodule:: pink.tasks.frame_task | ||
:members: | ||
|
||
Joint coupling task | ||
=================== | ||
|
||
.. automodule:: pink.tasks.joint_coupling_task | ||
:members: | ||
|
||
Linear holonomic task | ||
===================== | ||
|
||
.. automodule:: pink.tasks.linear_holonomic_task | ||
:members: | ||
|
||
Posture task | ||
============ | ||
|
||
.. automodule:: pink.tasks.posture_task | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/* Compatability shim for jQuery and underscores.js. | ||
* | ||
* Copyright Sphinx contributors | ||
* Released under the two clause BSD licence | ||
*/ | ||
|
||
/** | ||
* small helper function to urldecode strings | ||
* | ||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL | ||
*/ | ||
jQuery.urldecode = function(x) { | ||
if (!x) { | ||
return x | ||
} | ||
return decodeURIComponent(x.replace(/\+/g, ' ')); | ||
}; | ||
|
||
/** | ||
* small helper function to urlencode strings | ||
*/ | ||
jQuery.urlencode = encodeURIComponent; | ||
|
||
/** | ||
* This function returns the parsed url parameters of the | ||
* current request. Multiple values per key are supported, | ||
* it will always return arrays of strings for the value parts. | ||
*/ | ||
jQuery.getQueryParameters = function(s) { | ||
if (typeof s === 'undefined') | ||
s = document.location.search; | ||
var parts = s.substr(s.indexOf('?') + 1).split('&'); | ||
var result = {}; | ||
for (var i = 0; i < parts.length; i++) { | ||
var tmp = parts[i].split('=', 2); | ||
var key = jQuery.urldecode(tmp[0]); | ||
var value = jQuery.urldecode(tmp[1]); | ||
if (key in result) | ||
result[key].push(value); | ||
else | ||
result[key] = [value]; | ||
} | ||
return result; | ||
}; | ||
|
||
/** | ||
* highlight a given string on a jquery object by wrapping it in | ||
* span elements with the given class name. | ||
*/ | ||
jQuery.fn.highlightText = function(text, className) { | ||
function highlight(node, addItems) { | ||
if (node.nodeType === 3) { | ||
var val = node.nodeValue; | ||
var pos = val.toLowerCase().indexOf(text); | ||
if (pos >= 0 && | ||
!jQuery(node.parentNode).hasClass(className) && | ||
!jQuery(node.parentNode).hasClass("nohighlight")) { | ||
var span; | ||
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); | ||
if (isInSVG) { | ||
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); | ||
} else { | ||
span = document.createElement("span"); | ||
span.className = className; | ||
} | ||
span.appendChild(document.createTextNode(val.substr(pos, text.length))); | ||
node.parentNode.insertBefore(span, node.parentNode.insertBefore( | ||
document.createTextNode(val.substr(pos + text.length)), | ||
node.nextSibling)); | ||
node.nodeValue = val.substr(0, pos); | ||
if (isInSVG) { | ||
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); | ||
var bbox = node.parentElement.getBBox(); | ||
rect.x.baseVal.value = bbox.x; | ||
rect.y.baseVal.value = bbox.y; | ||
rect.width.baseVal.value = bbox.width; | ||
rect.height.baseVal.value = bbox.height; | ||
rect.setAttribute('class', className); | ||
addItems.push({ | ||
"parent": node.parentNode, | ||
"target": rect}); | ||
} | ||
} | ||
} | ||
else if (!jQuery(node).is("button, select, textarea")) { | ||
jQuery.each(node.childNodes, function() { | ||
highlight(this, addItems); | ||
}); | ||
} | ||
} | ||
var addItems = []; | ||
var result = this.each(function() { | ||
highlight(this, addItems); | ||
}); | ||
for (var i = 0; i < addItems.length; ++i) { | ||
jQuery(addItems[i].parent).before(addItems[i].target); | ||
} | ||
return result; | ||
}; | ||
|
||
/* | ||
* backward compatibility for jQuery.browser | ||
* This will be supported until firefox bug is fixed. | ||
*/ | ||
if (!jQuery.browser) { | ||
jQuery.uaMatch = function(ua) { | ||
ua = ua.toLowerCase(); | ||
|
||
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || | ||
/(webkit)[ \/]([\w.]+)/.exec(ua) || | ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || | ||
/(msie) ([\w.]+)/.exec(ua) || | ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || | ||
[]; | ||
|
||
return { | ||
browser: match[ 1 ] || "", | ||
version: match[ 2 ] || "0" | ||
}; | ||
}; | ||
jQuery.browser = {}; | ||
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.