Skip to content

Commit baa380a

Browse files
committed
Merge branch 'master' of github.com:petercorke/robotics-toolbox-python
2 parents 9edac37 + 136f7e5 commit baa380a

File tree

8 files changed

+60
-25
lines changed

8 files changed

+60
-25
lines changed

examples/rtb.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import argparse
1717
from math import pi # lgtm [py/unused-import]
1818
import numpy as np
19-
import matplotlib as plt # lgtm [py/unused-import]
20-
from roboticstoolbox import * # lgtm [py/unused-import]
19+
import matplotlib.pyplot as plt # lgtm [py/unused-import]
20+
from roboticstoolbox import * # lgtm [py/unused-import]
2121
from spatialmath import * # lgtm [py/polluting-import]
2222
from spatialmath.base import * # lgtm [py/polluting-import]
2323

@@ -52,6 +52,10 @@
5252
from roboticstoolbox import *
5353
from spatialmath import *
5454
55+
func/object? - show brief help
56+
help(func/object) - show detailed help
57+
func/object?? - show source code
58+
5559
""")
5660

5761
if args.script is not None:
@@ -60,6 +64,16 @@
6064
raise ValueError(f"script does not exist: {args.script}")
6165
exec(path.read_text())
6266

63-
# drop into IPython
67+
68+
## drop into IPython
6469
import IPython
65-
IPython.embed()
70+
from traitlets.config import Config
71+
72+
# set configuration options, there are lots, see
73+
# https://ipython.readthedocs.io/en/stable/config/options/terminal.html
74+
c = Config()
75+
c.InteractiveShellEmbed.colors = "Linux"
76+
c.InteractiveShell.colors = 'Neutral'
77+
c.InteractiveShell.confirm_exit = False
78+
79+
IPython.embed(config=c)

roboticstoolbox/data/gimbal-ring1.stl

163 KB
Binary file not shown.

roboticstoolbox/data/gimbal-ring2.stl

163 KB
Binary file not shown.

roboticstoolbox/data/gimbal-ring3.stl

169 KB
Binary file not shown.
488 KB
Binary file not shown.

roboticstoolbox/mobile/animations.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class VehiclePolygon(VehicleAnimation):
105105

106106
def __init__(self, shape='car', scale=1, **kwargs):
107107
"""
108-
Create graphical animation of vehicle as an icon
108+
Create graphical animation of vehicle as a polygon
109109
110110
:param shape: polygon shape, defaults to 'car'
111111
:type shape: str
@@ -127,9 +127,10 @@ def __init__(self, shape='car', scale=1, **kwargs):
127127
veh.run(animation=a)
128128
129129
``shape`` can be:
130+
130131
* ``"car"`` a rectangle with a pointy front
131132
* ``"triangle"`` a triangle
132-
* an Nx2 array of vertices, does not have to be closed.
133+
* an Nx2 NumPy array of vertices, does not have to be closed.
133134
134135
:seealso: :func:`~Vehicle`
135136
"""
@@ -210,6 +211,15 @@ def __init__(self, filename, origin=None, scale=1, rotation=0):
210211
* ``"redcar"`` a red car (top view)
211212
* path to an image file, including extension
212213
214+
.. image:: ../../roboticstoolbox/data/greycar.png
215+
:width: 200px
216+
:align: center
217+
218+
.. image:: ../../roboticstoolbox/data/redcar.png
219+
:width: 300px
220+
:align: center
221+
222+
213223
The car is scaled to an image with a length of ``scale`` in the units of
214224
the plot.
215225

roboticstoolbox/mobile/vehicle.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Vehicle(ABC):
2222
def __init__(self, covar=None, speed_max=np.inf, accel_max=np.inf, x0=None, dt=0.1,
2323
control=None, animation=None, verbose=False, dim=10):
2424
r"""
25-
Superclass for vehicle kino-dynamic models
25+
Superclass for vehicle kinematic models
2626
2727
:param covar: odometry covariance, defaults to zero
2828
:type covar: ndarray(2,2), optional
@@ -260,7 +260,7 @@ def deriv(self, x, u):
260260

261261
def add_driver(self, driver):
262262
"""
263-
Add a driver agent
263+
Add a driver agent (superclass method)
264264
265265
:param driver: a driver agent object
266266
:type driver: VehicleDriver subclass
@@ -277,7 +277,7 @@ def add_driver(self, driver):
277277

278278
def run(self, N=1000, x0=None, control=None, animation=None, plot=True):
279279
"""
280-
Simulate motion of vehicle
280+
Simulate motion of vehicle (superclass method)
281281
282282
:param N: Number of simulation steps, defaults to 1000
283283
:type N: int, optional
@@ -330,7 +330,7 @@ def run(self, N=1000, x0=None, control=None, animation=None, plot=True):
330330

331331
def init(self, x0=None, animation=None, plot=False, control=None):
332332
"""
333-
Initialize for simulation
333+
Initialize for simulation (superclass method)
334334
335335
:param x0: Initial state, defaults to value given to Vehicle constructor
336336
:type x0: array_like(3) or array_like(2)
@@ -390,7 +390,7 @@ def init(self, x0=None, animation=None, plot=False, control=None):
390390

391391
def step(self, u1=None, u2=None):
392392
"""
393-
Step simulator by one time step
393+
Step simulator by one time step (superclass method)
394394
395395
:return: odometry :math:`(\delta_d, \delta_\theta)`
396396
:rtype: ndarray(2)
@@ -453,7 +453,7 @@ def step(self, u1=None, u2=None):
453453

454454
def eval_control(self, control, x):
455455
"""
456-
Evaluate vehicle control input
456+
Evaluate vehicle control input (superclass method)
457457
458458
:param control: vehicle control
459459
:type control: [type]
@@ -500,7 +500,7 @@ def eval_control(self, control, x):
500500

501501
def stopif(self, stop):
502502
"""
503-
Stop the simulation
503+
Stop the simulation (superclass method)
504504
505505
:param stop: stop condition
506506
:type stop: bool
@@ -515,7 +515,7 @@ def stopif(self, stop):
515515

516516
def plot(self, path=None, block=True):
517517
"""
518-
[summary]
518+
[summary] (superclass method)
519519
520520
:param path: [description], defaults to None
521521
:type path: [type], optional
@@ -540,7 +540,7 @@ def plot_xyt_t(self, block=True, **kwargs):
540540

541541
def limits_va(self, v):
542542
"""
543-
Apply velocity and acceleration limits
543+
Apply velocity and acceleration limits (superclass method)
544544
545545
:param v: commanded velocity
546546
:type v: float
@@ -564,7 +564,7 @@ def limits_va(self, v):
564564

565565
def path(self, t=10, u=None, x0=None):
566566
"""
567-
Compute path by integration
567+
Compute path by integration (superclass method)
568568
569569
:param t: [description], defaults to None
570570
:type t: [type], optional
@@ -621,14 +621,16 @@ def __init__(self,
621621
**kwargs
622622
):
623623
r"""
624-
Create new bicycle kino-dynamic model
624+
Create new bicycle kinematic model
625625
626626
:param l: wheel base, defaults to 1
627627
:type l: float, optional
628628
:param steer_max: [description], defaults to :math:`0.45\pi`
629629
:type steer_max: float, optional
630-
:param **kwargs: additional arguments passed to :func:`Vehicle`
630+
:param **kwargs: additional arguments passed to :class:`Vehicle`
631631
constructor
632+
633+
:seealso: :class:`.Vehicle`
632634
"""
633635
super().__init__(**kwargs)
634636

@@ -803,6 +805,16 @@ class Unicycle(Vehicle):
803805
def __init__(self,
804806
w=1,
805807
**kwargs):
808+
r"""
809+
Create new unicycle kinematic model
810+
811+
:param w: vehicle width, defaults to 1
812+
:type w: float, optional
813+
:param **kwargs: additional arguments passed to :class:`Vehicle`
814+
constructor
815+
816+
:seealso: :class:`.Vehicle`
817+
"""
806818
super().__init__(**kwargs)
807819
self._w = w
808820

roboticstoolbox/tools/data.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ def loadmat(filename):
2323
"""
2424
from scipy.io import loadmat
2525

26-
path = path_to_datafile(filename)
27-
return loaddata(path, loadmat, squeeze_me=True, struct_as_record=False)
26+
return loaddata(filename, loadmat, squeeze_me=True, struct_as_record=False)
2827

2928
def loaddata(filename, handler, **kwargs):
3029
"""
@@ -79,7 +78,7 @@ def path_to_datafile(filename):
7978
# just a filename, no path, assume it is in roboticstoolbox/data
8079
p = Path(__file__).parent.parent / 'data' / filename
8180
if p.exists():
82-
return str(p)
81+
return str(p.resolve())
8382

8483
p = filename.expanduser()
8584
p = p.resolve()
@@ -91,9 +90,9 @@ def path_to_datafile(filename):
9190

9291
a = loadmat("map1.mat")
9392
print(a)
94-
a = loadmat("roboticstoolbox/data/map1.mat")
95-
print(a)
96-
a = loadmat("roboticstoolbox/data/../data/map1.mat")
97-
print(a)
93+
# a = loadmat("roboticstoolbox/data/map1.mat")
94+
# print(a)
95+
# a = loadmat("roboticstoolbox/data/../data/map1.mat")
96+
# print(a)
9897
a = loadmat("~/code/robotics-toolbox-python/roboticstoolbox/data/map1.mat")
9998
print(a)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy