Skip to content

Commit a173f10

Browse files
committed
Merge branch 'jesse-dev'
2 parents 1f1f8a7 + 01ef378 commit a173f10

35 files changed

+1041
-133
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ dmypy.json
134134
# Pyre type checker
135135
.pyre/
136136

137+
### VisualStudioCode ###
138+
.vscode/settings.json
139+
140+
### VisualStudioCode Patch ###
141+
# Ignore all local history of files
142+
.history
137143
# pytype static type analyzer
138144
.pytype/
139145

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# robotics-toolbox-python
22
Robotics Toolbox for Python
33

4-
This is an old first attempt at creating an open Python version of the venerable Robotics Toolbox for MATLAB.
5-
6-
A more active Python port is [robopy](https://github.com/adityadua24/robopy).
4+
This is an attempt at creating an open Python version of the venerable Robotics Toolbox for MATLAB.

robot/__init__.py

Lines changed: 0 additions & 120 deletions
This file was deleted.

roboticstoolbox/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from roboticstoolbox.robot import *
2+
from roboticstoolbox.models import *

roboticstoolbox/models/Panda.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/usr/bin/env python
2+
3+
import numpy as np
4+
from roboticstoolbox.robot.ets import ets, et
5+
# from rtb.tools.transform import transl, xyzrpy_to_trans
6+
7+
8+
class Panda(ets):
9+
"""
10+
A class representing the Franka Emika Panda robot arm. ETS taken from [1]
11+
based on https://frankaemika.github.io/docs/control_parameters.html
12+
13+
:param et_list: List of elementary transforms which represent the robot
14+
kinematics
15+
:type et_list: list of etb.robot.et
16+
:param q_idx: List of indexes within the ets_list which correspond to
17+
joints
18+
:type q_idx: list of int
19+
:param name: Name of the robot
20+
:type name: str, optional
21+
:param manufacturer: Manufacturer of the robot
22+
:type manufacturer: str, optional
23+
:param base: Location of the base is the world frame
24+
:type base: float np.ndarray(4,4), optional
25+
:param tool: Offset of the flange of the robot to the end-effector
26+
:type tool: float np.ndarray(4,4), optional
27+
:param qz: The zero joint angle configuration of the robot
28+
:type qz: float np.ndarray(7,)
29+
:param qr: The ready state joint angle configuration of the robot
30+
:type qr: float np.ndarray(7,)
31+
32+
References: [1] Kinematic Derivatives using the Elementary Transform
33+
Sequence, J. Haviland and P. Corke
34+
"""
35+
def __init__(self):
36+
37+
deg = np.pi/180
38+
mm = 1e-3
39+
d7 = (58.4)*mm
40+
41+
et_list = [
42+
et(et.Ttz, 0.333),
43+
et(et.TRz, i=1),
44+
et(et.TRx, -90*deg),
45+
et(et.TRz, i=2),
46+
et(et.TRx, 90*deg),
47+
et(et.Ttz, 0.316),
48+
et(et.TRz, i=3),
49+
et(et.Ttx, 0.0825),
50+
et(et.TRx, 90*deg),
51+
et(et.TRz, i=4),
52+
et(et.Ttx, -0.0825),
53+
et(et.TRx, -90*deg),
54+
et(et.Ttz, 0.384),
55+
et(et.TRz, i=5),
56+
et(et.TRx, 90*deg),
57+
et(et.TRz, i=6),
58+
et(et.Ttx, 0.088),
59+
et(et.TRx, 90*deg),
60+
et(et.Ttz, 0.107),
61+
et(et.TRz, i=7),
62+
]
63+
64+
q_idx = [1, 3, 6, 9, 13, 15, 19]
65+
66+
super(Panda, self).__init__(
67+
et_list,
68+
q_idx,
69+
name='Panda',
70+
manufacturer='Franka Emika',
71+
tool=np.eye(4))
72+
73+
# tool = xyzrpy_to_trans(0, 0, d7, 0, 0, -np.pi/4)
74+
75+
self._qz = np.array([0, 0, 0, 0, 0, 0, 0])
76+
self._qr = np.array([0, -90, -90, 90, 0, -90, 90]) * deg
77+
78+
@property
79+
def qz(self):
80+
return self._qz
81+
82+
@property
83+
def qr(self):
84+
return self._qr

roboticstoolbox/models/PandaMDH.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env python
2+
3+
import numpy as np
4+
from rtb.robot.Link import Revolute
5+
from rtb.robot.serial_link import SerialLink
6+
# from rtb.tools.transform import transl, xyzrpy_to_trans
7+
8+
class PandaMDH(SerialLink):
9+
"""
10+
A class representing the Franka Emika Panda robot arm.
11+
12+
DH Parameters taken from https://frankaemika.github.io/docs/control_parameters.html
13+
14+
Attributes:
15+
--------
16+
name : string
17+
Name of the robot
18+
manufacturer : string
19+
Manufacturer of the robot
20+
links : List[n]
21+
Series of links which define the robot
22+
base : float np.ndarray(4,4)
23+
Locaation of the base
24+
tool : float np.ndarray(4,4)
25+
Location of the tool
26+
mdh : int
27+
1: Pnada is modified D&H
28+
n : int
29+
Number of joints in the robot
30+
31+
Examples
32+
--------
33+
>>> panda = Panda()
34+
35+
See Also
36+
--------
37+
ropy.robot.SerialLink : A superclass for arm type robots
38+
"""
39+
40+
def __init__(self):
41+
42+
deg = np.pi/180
43+
mm = 1e-3
44+
45+
flange = (107)*mm
46+
d7 = (58.4)*mm
47+
48+
L1 = Revolute(a = 0.0, d = 0.333, alpha = 0.0, qlim = np.array([-2.8973, 2.8973]), mdh = 1)
49+
L2 = Revolute(a = 0.0, d = 0.0, alpha = -np.pi/2, qlim = np.array([-1.7628, 1.7628]), mdh = 1)
50+
L3 = Revolute(a = 0.0, d = 0.316, alpha = np.pi/2, qlim = np.array([-2.8973, 2.8973]), mdh = 1)
51+
L4 = Revolute(a = 0.0825, d = 0.0, alpha = np.pi/2, qlim = np.array([-3.0718, -0.0698]), mdh = 1)
52+
L5 = Revolute(a =-0.0825, d = 0.384, alpha = -np.pi/2, qlim = np.array([-2.8973, 2.8973]), mdh = 1)
53+
L6 = Revolute(a = 0.0, d = 0.0, alpha = np.pi/2, qlim = np.array([-0.0175, 3.7525]), mdh = 1)
54+
L7 = Revolute(a = 0.088, d =flange, alpha = np.pi/2, qlim = np.array([-2.8973, 2.8973]), mdh = 1)
55+
56+
L = [L1, L2, L3, L4, L5, L6, L7]
57+
58+
# super(Panda, self).__init__(L, name = 'Panda', manufacturer = 'Franka Emika', tool = transl(0, 0, d7))
59+
60+
super(PandaMDH, self).__init__(L, name = 'Panda', manufacturer = 'Franka Emika', tool=np.eye(4))
61+
62+
# tool = xyzrpy_to_trans(0, 0, d7, 0, 0, -np.pi/4)
63+
64+
self.qz = np.array([0, 0, 0, 0, 0, 0, 0])
65+
self.qr = np.array([0, -90, -90, 90, 0, -90, 90]) * deg
66+

roboticstoolbox/models/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Robot Models
2+
from roboticstoolbox.models.Panda import Panda
3+
# from roboticstoolbox.models.PandaMDH import PandaMDH
4+
5+
__all__ = [
6+
'Panda'
7+
# 'PandaMDH'
8+
]

robot/Link.py renamed to roboticstoolbox/robot/Link.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
"""
22
Link object.
3-
43
Python implementation by: Luis Fernando Lara Tobar and Peter Corke.
54
Based on original Robotics Toolbox for Matlab code by Peter Corke.
65
Permission to use and copy is granted provided that acknowledgement of
76
the authors is made.
8-
97
@author: Luis Fernando Lara Tobar and Peter Corke
108
"""
119

@@ -18,7 +16,6 @@
1816
class Link:
1917
"""
2018
LINK create a new LINK object
21-
2219
A LINK object holds all information related to a robot link such as
2320
kinematics of the joint
2421
- alpha; the link twist angle
@@ -31,22 +28,18 @@ class Link:
3128
- I; 3x3 inertia matrix about link COG
3229
- m; link mass
3330
- r; link COG wrt link coordinate frame 3x1
34-
3531
motor and transmission parameters
3632
- B; link viscous friction (motor referred)
3733
- Tc; link Coulomb friction 1 element if symmetric, else 2
3834
- G; gear ratio
3935
- Jm; inertia (motor referred)
40-
4136
and miscellaneous
4237
- qlim; joint limit matrix [lower upper] 2 x 1
4338
- offset; joint coordinate offset
4439
Handling the different kinematic conventions is now hidden within the LINK
4540
object.
46-
4741
Conceivably all sorts of stuff could live in the LINK object such as
4842
graphical models of links and so on.
49-
5043
@see: L{Robot}
5144
"""
5245

@@ -61,12 +54,10 @@ def __init__(self, alpha=0, A=0, theta=0, D=0, sigma=0, convention=LINK_DH):
6154
L =LINK([alpha A theta D], CONVENTION)
6255
L =LINK([alpha A theta D sigma], CONVENTION)
6356
L =LINK([alpha A theta D sigma offset], CONVENTION)
64-
6557
If sigma or offset are not provided they default to zero. Offset is a
6658
constant amount added to the joint angle variable before forward kinematics
6759
and is useful if you want the robot to adopt a 'sensible' pose for zero
6860
joint angle configuration.
69-
7061
The optional CONVENTION argument is 'standard' for standard D&H parameters
7162
or 'modified' for modified D&H parameters. If not specified the default
7263
'standard'.
@@ -351,4 +342,4 @@ def tr(self, q):
351342
[st*sa, ct*sa, ca, ca*dn],
352343
[0, 0, 0, 1]]);
353344

354-
return t;
345+
return t;
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)