Name | rtb-toolbox JSON |
Version |
0.1.67
JSON |
| download |
home_page | |
Summary | |
upload_time | 2023-11-27 00:23:49 |
maintainer | |
docs_url | None |
author | Miguel |
requires_python | >=3.10,<4.0 |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Robotic Tools
Robotic tools is a library made to make some calculations easier, like robots forward
kinematic's and dynamics. There is also an numerical implementation of inverse velocity kinematic's.
You can use this lib for any robot, since you have the Denavit Hartenberg parameters.
## Forward Kinematics
in order to use the forward kinematics, you gonna need the robot DH parameters. Then
u can create a 'Link' object representation for each link, using the parameters.
```python
import sympy as sp
from lib.link import Link
q1, q2, q3 = sp.symbols('q_1 q_2 q_3')
j0 = Link([q1, 450, 150, sp.pi / 2])
j1 = Link([q2, 0, 590, 0])
j2 = Link([q3, 0, 130, sp.pi / 2])
```
Finally create an instance of the ForwardKinematic class, and pass a list with
all links in the constructor. You can also pass an offset with the angles of home position.
```python
from lib.forward_kinematics import ForwardKinematic
fk = ForwardKinematic([j0, j1, j2], offset=np.array([.0, .0, .0]))
```
The ForwardKinematic class contains the symbolic matrices of transformations, like transformations
from the reference frame to the i-th frame, the end-effector transformation matrix, the jacobian matrix, and other
things.
## Inverse Kinematics
To use the inverse kinematics u need first to have the ForwardKinematic of the robot
### Inverse Kinematics of Position
The inverse kinematics of position uses the Gradient Descent method to find an optimal solution
for the end-effector position.
To use it, as said before, u need the ForwardKinematic. Then, just import the ik_position
method from lib.inverse_kinematics package
```python
import numpy as np
from lib.inverse_kinematics import ik_position
# PX, Py, Pz
desired_position = np.array([.1, .4, .0])
thetas, _, success = ik_position(
desired_position=desired_position,
fk=fk,
initial_guess=np.array([.2, .7, -.1]),
f_tolerance=1e-5,
max_iterations=1000,
lmbd=.1,
verbose=True
)
```
Output example of the inverse kinematics of position:
![position ik](images/partial_ik.png)
### Inverse Kinematics of Position and Orientation
The inverse kinematics of position and orientation uses the jacobian matrix and end-effector velocities
necessary to achive an wanted transformation. This method is also called inverse velocity kinematics. The
end-effector velocities mentioned before are calculated using the methods explained in
Modern Robotics Book (http://hades.mech.northwestern.edu/index.php/Modern_Robotics).
```python
import numpy as np
from lib.inverse_kinematics import ik
# Px, Py, Pz, Rx, Ry, Rz
desired_transformation = np.array([.1, .4, .0, 0, np.pi / 4, 0])
thetas, _, success = ik(
desired_transformation=desired_transformation,
fk=fk,
initial_guess=np.array([.2, .7, -.1]),
epsilon_wb=1e-5,
epsilon_vb=1e-5,
max_iterations=1000,
lmbd=.1,
verbose=True,
only_position=False,
normalize=False
)
```
Output example for the inverse kinematics of position and orientation
![position ik](images/full_ik.png)
## Forward Dynamics
In order to compute the ForwardDynamics u first need the ForwardKinematic of the robot.
When u instantiate the ForwardDynamic class, it will start to calculate the equations of motion (resulting torque's)
in each link, so it can take a long time if you use the simplify method of sympy library.
The joint variables (thetas) need to be functions of time.
```python
from lib.symbols import t
import sympy as sp
from lib.forward_kinematics import ForwardKinematic
from lib.forward_dynamics import ForwardDynamics
from lib.link import Link
# To use the forward dynamics, the q's need to be functions of time
q1 = sp.Function('q_1')(t)
q2 = sp.Function('q_2')(t)
a1, a2 = sp.symbols('a_1 a_2')
j0 = Link([q1, 0, a1, 0])
j1 = Link([q2, 0, a2, 0])
rr_fk = ForwardKinematic([j0, j1])
fd = ForwardDynamics(rr_fk)
for eq in fd.equations:
print(' ')
sp.print_latex(sp.simplify(eq))
print(' ')
```
Example of forward dynamic equations of an RR planar robot
![tau 1](images/tau1.png)
![tau 2](images/tau2.png)
Raw data
{
"_id": null,
"home_page": "",
"name": "rtb-toolbox",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Miguel",
"author_email": "miguellukas52@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e0/f6/711b401e23f640603062f0eb23eeea31c6e2c3c44771686a3b26b7a273da/rtb_toolbox-0.1.67.tar.gz",
"platform": null,
"description": "# Robotic Tools\n\nRobotic tools is a library made to make some calculations easier, like robots forward\nkinematic's and dynamics. There is also an numerical implementation of inverse velocity kinematic's.\n\nYou can use this lib for any robot, since you have the Denavit Hartenberg parameters.\n\n## Forward Kinematics\n\nin order to use the forward kinematics, you gonna need the robot DH parameters. Then\nu can create a 'Link' object representation for each link, using the parameters.\n\n```python\nimport sympy as sp\nfrom lib.link import Link\n\nq1, q2, q3 = sp.symbols('q_1 q_2 q_3')\n\nj0 = Link([q1, 450, 150, sp.pi / 2])\nj1 = Link([q2, 0, 590, 0])\nj2 = Link([q3, 0, 130, sp.pi / 2])\n```\n\nFinally create an instance of the ForwardKinematic class, and pass a list with\nall links in the constructor. You can also pass an offset with the angles of home position.\n\n```python\nfrom lib.forward_kinematics import ForwardKinematic\n\nfk = ForwardKinematic([j0, j1, j2], offset=np.array([.0, .0, .0]))\n```\n\nThe ForwardKinematic class contains the symbolic matrices of transformations, like transformations\nfrom the reference frame to the i-th frame, the end-effector transformation matrix, the jacobian matrix, and other\nthings.\n\n## Inverse Kinematics\n\nTo use the inverse kinematics u need first to have the ForwardKinematic of the robot\n\n### Inverse Kinematics of Position\n\nThe inverse kinematics of position uses the Gradient Descent method to find an optimal solution\nfor the end-effector position.\n\nTo use it, as said before, u need the ForwardKinematic. Then, just import the ik_position\nmethod from lib.inverse_kinematics package\n\n```python\nimport numpy as np\nfrom lib.inverse_kinematics import ik_position\n\n# PX, Py, Pz\ndesired_position = np.array([.1, .4, .0])\n\nthetas, _, success = ik_position(\n desired_position=desired_position,\n fk=fk,\n initial_guess=np.array([.2, .7, -.1]),\n f_tolerance=1e-5,\n max_iterations=1000,\n lmbd=.1,\n verbose=True\n)\n```\n\nOutput example of the inverse kinematics of position:\n![position ik](images/partial_ik.png)\n\n### Inverse Kinematics of Position and Orientation\n\nThe inverse kinematics of position and orientation uses the jacobian matrix and end-effector velocities\nnecessary to achive an wanted transformation. This method is also called inverse velocity kinematics. The\nend-effector velocities mentioned before are calculated using the methods explained in\nModern Robotics Book (http://hades.mech.northwestern.edu/index.php/Modern_Robotics).\n\n```python\nimport numpy as np\nfrom lib.inverse_kinematics import ik\n\n# Px, Py, Pz, Rx, Ry, Rz\ndesired_transformation = np.array([.1, .4, .0, 0, np.pi / 4, 0])\n\nthetas, _, success = ik(\n desired_transformation=desired_transformation,\n fk=fk,\n initial_guess=np.array([.2, .7, -.1]),\n epsilon_wb=1e-5,\n epsilon_vb=1e-5,\n max_iterations=1000,\n lmbd=.1,\n verbose=True,\n only_position=False,\n normalize=False\n)\n```\n\nOutput example for the inverse kinematics of position and orientation\n![position ik](images/full_ik.png)\n\n## Forward Dynamics\n\nIn order to compute the ForwardDynamics u first need the ForwardKinematic of the robot.\nWhen u instantiate the ForwardDynamic class, it will start to calculate the equations of motion (resulting torque's)\nin each link, so it can take a long time if you use the simplify method of sympy library.\n\nThe joint variables (thetas) need to be functions of time.\n\n```python\nfrom lib.symbols import t\nimport sympy as sp\n\nfrom lib.forward_kinematics import ForwardKinematic\nfrom lib.forward_dynamics import ForwardDynamics\nfrom lib.link import Link\n\n# To use the forward dynamics, the q's need to be functions of time\n\nq1 = sp.Function('q_1')(t)\nq2 = sp.Function('q_2')(t)\na1, a2 = sp.symbols('a_1 a_2')\n\nj0 = Link([q1, 0, a1, 0])\nj1 = Link([q2, 0, a2, 0])\n\nrr_fk = ForwardKinematic([j0, j1])\n\nfd = ForwardDynamics(rr_fk)\nfor eq in fd.equations:\n print(' ')\n sp.print_latex(sp.simplify(eq))\n print(' ')\n```\n\nExample of forward dynamic equations of an RR planar robot\n![tau 1](images/tau1.png)\n![tau 2](images/tau2.png)",
"bugtrack_url": null,
"license": "",
"summary": "",
"version": "0.1.67",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b943f350c59d1408134d31be6e27148bb3e87e5c5cad17c37ae687f631fb3c21",
"md5": "87ceaa5174ede44822f3eded148e5aa4",
"sha256": "0fb825b829b9fecf2afe55b0dfe1a7fc9b390f74d9baf23f10a3468caa86ad18"
},
"downloads": -1,
"filename": "rtb_toolbox-0.1.67-py3-none-any.whl",
"has_sig": false,
"md5_digest": "87ceaa5174ede44822f3eded148e5aa4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 520792,
"upload_time": "2023-11-27T00:23:45",
"upload_time_iso_8601": "2023-11-27T00:23:45.880536Z",
"url": "https://files.pythonhosted.org/packages/b9/43/f350c59d1408134d31be6e27148bb3e87e5c5cad17c37ae687f631fb3c21/rtb_toolbox-0.1.67-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e0f6711b401e23f640603062f0eb23eeea31c6e2c3c44771686a3b26b7a273da",
"md5": "fe1bbd7c8476fad034ba78ab25e8a163",
"sha256": "5e0850ec4e2280dda025557d3c7ffbcb6c2533eb82659ef4566a602ce44c5884"
},
"downloads": -1,
"filename": "rtb_toolbox-0.1.67.tar.gz",
"has_sig": false,
"md5_digest": "fe1bbd7c8476fad034ba78ab25e8a163",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 528966,
"upload_time": "2023-11-27T00:23:49",
"upload_time_iso_8601": "2023-11-27T00:23:49.019476Z",
"url": "https://files.pythonhosted.org/packages/e0/f6/711b401e23f640603062f0eb23eeea31c6e2c3c44771686a3b26b7a273da/rtb_toolbox-0.1.67.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-27 00:23:49",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "rtb-toolbox"
}