Skip to content

Commit 338d960

Browse files
committed
2 parents c77faac + a8e5187 commit 338d960

File tree

21 files changed

+1311
-1130
lines changed

21 files changed

+1311
-1130
lines changed

.github/workflows/future_testing.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [ future ]
6+
7+
jobs:
8+
unittest:
9+
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [windows-latest, ubuntu-latest, macos-latest]
14+
python-version: [3.6, 3.7, 3.8, 3.9]
15+
16+
steps:
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
- name: Checkout future branch
23+
uses: actions/checkout@v2
24+
with:
25+
ref: future
26+
path: rtb
27+
28+
- name: Checkout Swift
29+
uses: actions/checkout@v2
30+
with:
31+
repository: jhavl/swift
32+
path: swift
33+
34+
- name: Checkout Spatialmath
35+
uses: actions/checkout@v2
36+
with:
37+
repository: petercorke/spatialmath-python
38+
path: sm
39+
40+
- name: Checkout Spatialgeometry
41+
uses: actions/checkout@v2
42+
with:
43+
repository: jhavl/spatialgeometry
44+
path: sg
45+
46+
- name: Install dependencies
47+
run: |
48+
python -m pip install --upgrade pip
49+
cd sm
50+
python -m pip install .
51+
cd ../sg
52+
python -m pip install .
53+
cd ../swift
54+
python -m pip install .
55+
cd ../rtb/rtb-data
56+
python -m pip install .
57+
- name: Test with pytest
58+
run: |
59+
cd rtb
60+
pip install .[dev,collision,vpython]
61+
pip install pytest-timeout
62+
pytest --timeout=50 --timeout_method thread -s

.github/workflows/python-publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
max-parallel: 2
1717
matrix:
1818
os: [macos-latest, windows-latest]
19-
python-version: [3.6, 3.7, 3.8]
19+
python-version: [3.6, 3.7, 3.8, 3.9]
2020

2121
steps:
2222
- uses: actions/checkout@v2

.github/workflows/pythonpackage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: [windows-latest, ubuntu-latest, macos-latest]
17-
python-version: [3.6, 3.7, 3.8]
17+
python-version: [3.6, 3.7, 3.8, 3.9]
1818
steps:
1919
- uses: actions/checkout@v2
2020
- name: Set up Python ${{ matrix.python-version }}

examples/swift2.py

-110
This file was deleted.

roboticstoolbox/backends/PyPlot/EllipsePlot.py

+28-29
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
import matplotlib.pyplot as plt
1010

1111

12-
class EllipsePlot():
13-
14-
def __init__(self, robot, q, etype, opt='trans', centre=[0, 0, 0], scale=1):
12+
class EllipsePlot:
13+
def __init__(self, robot, q, etype, opt="trans", centre=[0, 0, 0], scale=1):
1514

1615
super(EllipsePlot, self).__init__()
1716

@@ -21,10 +20,10 @@ def __init__(self, robot, q, etype, opt='trans', centre=[0, 0, 0], scale=1):
2120
centre = base.getvector(centre, 2)
2221
centre = np.array([centre[0], centre[1], 0])
2322
except TypeError:
24-
if centre != 'ee':
23+
if centre != "ee":
2524
raise ValueError(
26-
'Centre must be a three vector or \'ee\' meaning'
27-
'end-effector')
25+
"Centre must be a three vector or 'ee' meaning" "end-effector"
26+
)
2827

2928
self.ell = None
3029
self.robot = robot
@@ -38,12 +37,12 @@ def __init__(self, robot, q, etype, opt='trans', centre=[0, 0, 0], scale=1):
3837
else:
3938
self.q = q
4039

41-
if etype == 'v':
40+
if etype == "v":
4241
self.vell = True
43-
self.name = 'Velocity Ellipse'
44-
elif etype == 'f':
42+
self.name = "Velocity Ellipse"
43+
elif etype == "f":
4544
self.vell = False
46-
self.name = 'Force Ellipse'
45+
self.name = "Force Ellipse"
4746

4847
def draw(self):
4948
self.make_ellipsoid()
@@ -52,33 +51,32 @@ def draw(self):
5251
self.ax.collections.remove(self.ell)
5352

5453
self.ell = self.ax.plot_wireframe(
55-
self.x, self.y, self.z, rstride=6,
56-
cstride=6, color='#2980b9', alpha=0.2)
54+
self.x, self.y, self.z, rstride=6, cstride=6, color="#2980b9", alpha=0.2
55+
)
5756

5857
def draw2(self):
5958
self.make_ellipsoid2()
6059

6160
if self.ell is not None:
6261
self.ell[0].set_data(self.x, self.y)
6362
else:
64-
self.ell = self.ax.plot(
65-
self.x, self.y, color='#2980b9')
63+
self.ell = self.ax.plot(self.x, self.y, color="#2980b9")
6664

6765
def plot(self, ax=None):
6866
if ax is None:
6967
ax = self.ax
70-
68+
7169
if ax is None:
7270
fig = plt.figure()
73-
ax = plt.axes(projection='3d')
71+
ax = plt.axes(projection="3d")
7472
self.ax = ax
75-
73+
7674
self.draw()
7775

7876
def plot2(self, ax=None):
7977
if ax is None:
8078
ax = self.ax
81-
79+
8280
if ax is None:
8381
ax = plt.axes()
8482
self.ax = ax
@@ -91,18 +89,18 @@ def make_ellipsoid(self):
9189
9290
"""
9391

94-
if self.opt == 'trans':
92+
if self.opt == "trans":
9593
J = self.robot.jacobe(self.q)[3:, :]
9694
A = J @ J.T
97-
elif self.opt == 'rot':
95+
elif self.opt == "rot":
9896
J = self.robot.jacobe(self.q)[:3, :]
9997
A = J @ J.T
10098

10199
if not self.vell:
102100
# Do the extra step for the force ellipse
103101
A = np.linalg.inv(A)
104102

105-
if isinstance(self.centre, str) and self.centre == 'ee':
103+
if isinstance(self.centre, str) and self.centre == "ee":
106104
centre = self.robot.fkine(self.q).t
107105
else:
108106
centre = self.centre
@@ -121,8 +119,9 @@ def make_ellipsoid(self):
121119
# transform points to ellipsoid
122120
for i in range(len(x)):
123121
for j in range(len(x)):
124-
[x[i, j], y[i, j], z[i, j]] = \
125-
np.dot([x[i, j], y[i, j], z[i, j]], rotation)
122+
[x[i, j], y[i, j], z[i, j]] = np.dot(
123+
[x[i, j], y[i, j], z[i, j]], rotation
124+
)
126125

127126
self.x = x * self.scale + centre[0]
128127
self.y = y * self.scale + centre[1]
@@ -134,13 +133,13 @@ def make_ellipsoid2(self):
134133
135134
"""
136135

137-
if self.opt == 'trans':
136+
if self.opt == "trans":
138137
J = self.robot.jacob0(self.q)[:2, :]
139138
A = J @ J.T
140-
elif self.opt == 'rot':
139+
elif self.opt == "rot":
141140
raise ValueError(
142-
"Can not do rotational ellipse for a 2d robot plot."
143-
" Set opt='trans'")
141+
"Can not do rotational ellipse for a 2d robot plot." " Set opt='trans'"
142+
)
144143

145144
# if not self.vell:
146145
# # Do the extra step for the force ellipse
@@ -149,7 +148,7 @@ def make_ellipsoid2(self):
149148
# except:
150149
# A = np.zeros((2,2))
151150

152-
if isinstance(self.centre, str) and self.centre == 'ee':
151+
if isinstance(self.centre, str) and self.centre == "ee":
153152
centre = self.robot.fkine(self.q).t
154153
else:
155154
centre = self.centre
@@ -158,7 +157,7 @@ def make_ellipsoid2(self):
158157
theta = np.linspace(0.0, 2.0 * np.pi, 50)
159158
y = np.array([np.cos(theta), np.sin(theta)])
160159
# RVC2 p 602
161-
x = sp.linalg.sqrtm(A) @ y
160+
# x = sp.linalg.sqrtm(A) @ y
162161

163162
x, y = base.ellipse(A, inverted=True, centre=centre[:2], scale=self.scale)
164163
self.x = x

0 commit comments

Comments
 (0)