8
8
from roboticstoolbox .backends .Connector import Connector
9
9
import matplotlib
10
10
import matplotlib .pyplot as plt
11
- import signal
12
11
from roboticstoolbox .backends .PyPlot .RobotPlot import RobotPlot
13
12
from roboticstoolbox .backends .PyPlot .EllipsePlot import EllipsePlot
14
13
from spatialmath .base .argcheck import getvector
@@ -30,7 +29,7 @@ class PyPlot(Connector):
30
29
Graphical backend using matplotlib
31
30
32
31
matplotlib is a common and highly portable graphics library for Python,
33
- but has relatively limited 3D capability.
32
+ but has relatively limited 3D capability.
34
33
35
34
Example:
36
35
@@ -48,7 +47,7 @@ class PyPlot(Connector):
48
47
49
48
.. note:: PyPlot is the default backend, and ``robot.plot(q)`` effectively
50
49
performs lines 7-8 above.
51
-
50
+
52
51
"""
53
52
54
53
def __init__ (self ):
@@ -75,9 +74,9 @@ def launch(self, name=None, limits=None):
75
74
labels = ['X' , 'Y' , 'Z' ]
76
75
77
76
if name is not None :
78
- self .fig = plt .figure ()
77
+ self .fig = plt .figure (name )
79
78
else :
80
- self .fig = plt .figure ()
79
+ self .fig = plt .figure ('Robotics Toolbox for Python' )
81
80
82
81
self .fig .subplots_adjust (left = - 0.09 , bottom = 0 , top = 1 , right = 0.99 )
83
82
@@ -113,18 +112,18 @@ def step(self, dt=50):
113
112
114
113
:param dt: time step in milliseconds, defaults to 50
115
114
:type dt: int, optional
116
-
115
+
117
116
``env.step(args)`` triggers an update of the 3D scene in the matplotlib
118
117
window referenced by ``env``.
119
118
120
- .. note::
119
+ .. note::
121
120
122
121
- Each robot in the scene is updated based on
123
122
their control type (position, velocity, acceleration, or torque).
124
123
- Upon acting, the other three of the four control types will be
125
- updated in the internal state of the robot object.
126
- - The control type is defined by the robot object, and not all robot
127
- objects support all control types.
124
+ updated in the internal state of the robot object.
125
+ - The control type is defined by the robot object, and not all
126
+ robot objects support all control types.
128
127
- Execution is blocked for the specified interval
129
128
130
129
"""
@@ -160,8 +159,8 @@ def restart(self):
160
159
Restart the graphics display
161
160
162
161
``env.restart()`` triggers a restart of the matplotlib view referenced
163
- by ``env``. It is closed and relaunched to the original state defined by
164
- ``launch()``.
162
+ by ``env``. It is closed and relaunched to the original state defined
163
+ by ``launch()``.
165
164
166
165
"""
167
166
# TODO what does this actually do for matplotlib??
@@ -205,11 +204,12 @@ def add(
205
204
:param name: [description], defaults to True
206
205
:type name: bool, optional
207
206
208
- ``id = env.add(robot)`` adds the ``robot`` to the graphical environment.
207
+ ``id = env.add(robot)`` adds the ``robot`` to the graphical
208
+ environment.
209
209
210
210
.. note::
211
211
212
- - ``robot`` must be of an appropriate class.
212
+ - ``robot`` must be of an appropriate class.
213
213
- Adds the robot object to a list of robots which will be updated
214
214
when the ``step()`` method is called.
215
215
@@ -239,18 +239,19 @@ def remove(self):
239
239
"""
240
240
Remove a robot to the graphical scene
241
241
242
- :param id: The id of the robot to remove. Can be either the DHLink or
242
+ :param id: The id of the robot to remove. Can be either the DHLink or
243
243
GraphicalRobot
244
244
:type id: class:`~roboticstoolbox.robot.DHRobot.DHRobot`,
245
245
class:`roboticstoolbox.backends.VPython.graphics_robot.GraphicalRobot`
246
246
:param fig_num: The canvas index to delete the robot from, defaults to
247
247
the initial one
248
248
:type fig_num: int, optional
249
- :raises ValueError: Figure number must be between 0 and total number
249
+ :raises ValueError: Figure number must be between 0 and total number
250
250
of canvases
251
251
:raises TypeError: Input must be a DHLink or GraphicalRobot
252
252
253
- ``env.remove(robot)`` removes the ``robot`` from the graphical environment.
253
+ ``env.remove(robot)`` removes the ``robot`` from the graphical
254
+ environment.
254
255
"""
255
256
# TODO should be an id to remove?
256
257
0 commit comments