8000 Merge branch 'master' of https://github.com/petercorke/robotics-toolb… · ctc-eng/robotics-toolbox-python@5a305d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a305d9

Browse files
committed
# Conflicts: # roboticstoolbox/robot/Link.py
2 parents 276ffc5 + 8fcb457 commit 5a305d9

File tree

7 files changed

+40
-14
lines changed

7 files changed

+40
-14
lines changed

examples/test.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python
2+
"""
3+
@author Jesse Haviland
4+
"""
5+
6+
import roboticstoolbox as rtb
7+
import spatialmath as sm
8+
import numpy as np
9+
import qpsolvers as qp
10+
import time
11+
12+
# Launch the simulator Swift
13+
env = rtb.backend.Swift()
14+
env.launch()
15+
16+
# Create a Panda robot object
17+
puma = rtb.models.Puma560()
18+
19+
# Set joint angles to ready configuration
20+
puma.q = puma.qr
21+
22+
# Add the puma to the simulator
23+
env.add(puma)

roboticstoolbox/backend/Swift/Swift.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Swift(Connector): # pragma nocover
3838
:references:
3939
4040
- https://github.com/jhavl/swift
41-
41+
4242
"""
4343
def __init__(self):
4444
super(Swift, self).__init__()
@@ -72,11 +72,11 @@ def step(self, dt=50):
7272
7373
:param dt: time step in milliseconds, defaults to 50
7474
:type dt: int, optional
75-
75+
7676
``env.step(args)`` triggers an update of the 3D scene in the Swift
7777
window referenced by ``env``.
7878
79-
.. note::
79+
.. note::
8080
8181
- Each robot in the scene is updated based on
8282
their control type (position, velocity, acceleration, or torque).
@@ -89,7 +89,7 @@ def step(self, dt=50):
8989
"""
9090

9191
# TODO how is the pose of shapes updated prior to step?
92-
92+
9393
super().step
9494

9595
self._step_robots(dt)

roboticstoolbox/backend/urdf/urdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,7 @@ def __init__(self, name, links, joints=None,
17441744
# Store the visuals, collisions, and inertials
17451745
for i in range(len(joints)):
17461746
link = self._link_map[joints[i].child]
1747-
elinks[i].r = link.inertial.origin
1747+
elinks[i].r = link.inertial.origin[:3, 3]
17481748
elinks[i].m = link.ine 8000 rtial.mass
17491749
elinks[i].inertia = link.inertial.inertia
17501750

roboticstoolbox/robot/DHDynamics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ def _cross(a, b):
14271427
a[0] * b[1] - a[1] * b[0]]
14281428

14291429

1430-
if __name__ == "__main__":
1430+
if __name__ == "__main__": # pragma nocover
14311431

14321432
import roboticstoolbox as rtb
14331433
# from spatialmath.base import symbolic as sym

roboticstoolbox/robot/ERobot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def urdf_to_ets_args(self, file_path, tld=None):
265265
# get the path to the class that defines the robot
266266
classpath = sys.modules[self.__module__].__file__
267267
# add on relative path to get to the URDF or xacro file
268-
base_path = PurePath(classpath).parent.parent / 'xacro'
268+
base_path = PurePath(classpath).parent.parent / 'xacro'
269269
file_path = base_path / PurePosixPath(file_path)
270270
name, ext = splitext(file_path)
271271

roboticstoolbox/robot/Link.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
isscalar, isvector, ismatrix
66
from ansitable import ANSITable, Column
77

8+
89
def _listen_dyn(func):
910
"""
1011
Decorator for property setters
@@ -30,6 +31,7 @@ def wrapper_listen_dyn(*args):
3031
return func(*args)
3132
return wrapper_listen_dyn
3233

34+
3335
class Link:
3436
"""
3537
Link superclass
@@ -67,7 +69,8 @@ class Link:
6769
:parts: 2
6870
"""
6971

70-
def __init__(self,
72+
def __init__(
73+
self,
7174
name='',
7275
offset=0.0,
7376
qlim=np.zeros(2),
@@ -102,7 +105,6 @@ def __init__(self,
102105
self.Tc = Tc
103106
self.G = G
104107

105-
106108
def copy(self):
107109
"""
108110
Copy of link object
@@ -407,7 +409,7 @@ def flip(self):
407409
- ``link.flip = ...`` checks and sets the joint flip status
408410
409411
Joint flip defines the direction of motion of the joint.
410-
412+
411413
``flip = False`` is conventional motion direction:
412414
413415
- revolute motion is a positive rotation about the z-axis
@@ -485,14 +487,15 @@ def I(self): # noqa
485487
486488
- ``link.I = ...`` checks and sets the link inertia
487489
488-
Link inertia is a symmetric 3x3 matrix describing the inertia with respect
489-
to a frame with its origin at the centre of mass, and with axes parallel to those of
490-
the link frame.
490+
Link inertia is a symmetric 3x3 matrix describing the inertia with
491+
respect to a frame with its origin at the centre of mass, and with
492+
axes parallel to those of the link frame.
491493
492494
The inertia matrix is
493495
494496
:math:`\begin{bmatrix} I_{xx} & I_{xy} & I_{xz} \\ I_{xy} & I_{yy} & I_{yz} \\I_{xz} & I_{yz} & I_{zz} \end{bmatrix}`
495497
498+
496499
and can be specified as either:
497500
498501
- a 3 ⨉ 3 symmetric matrix

tests/test_ELink.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def test_properties(self):
160160
l0 = rp.ELink()
161161

162162
self.assertEqual(l0.m, 0.0)
163-
nt.assert_array_almost_equal(l0.r.A, np.eye(4))
163+
nt.assert_array_almost_equal(l0.r, np.zeros(3))
164164
self.assertEqual(l0.Jm, 0.0)
165165

166166
def test_fail_parent(self):

0 commit comments

Comments
 (0)
28EF
0