Mobile robot blocks

https://raw.githubusercontent.com/petercorke/bdsim/master/figs/BDSimLogo_NoBackgnd@2x.png
class roboticstoolbox.blocks.mobile.Bicycle(*args: Any, **kwargs: Any)[source]

Bases: ContinuousBlock

BICYCLE

Vehicle model with Bicycle kinematics.

Inputs:

2

Outputs:

1

States:

3

Port type

Port number

Types

Description

Input

0

float

\(v\), longitudinal velocity

Input

1

float

\(\gamma\), steer angle

Output

0

ndarray(3)

\(\mathit{q} = (x, y, \theta)\), vehicle configuration

Bicycle kinematic model with velocity and steering inputs and vehicle configuration as output.

Various limits are applied to the inputs:

  • velocity limit speed_max

  • acceleration limit accel_max

  • steering limit steer_max

Seealso:

Bicycle Unicycle DiffSteer

__init__(L=1, speed_max=inf, accel_max=inf, steer_max=1.413716694115407, x0=None, **blockargs)[source]
Parameters:
  • L (float, optional) – Wheelbase, defaults to 1

  • speed_max (float, optional) – Velocity limit, defaults to math.inf

  • accel_max (float, optional) – maximum acceleration, defaults to math.inf

  • steer_max (float, optional) – maximum steered wheel angle, defaults to math.pi*0.45

  • x0 (array_like(3), optional) – Initial state, defaults to [0,0,0]

  • blockargs (dict) – common Block options

Deprecated since version the: vlim and slim keywords are deprecated, use speed_max and steer_max instead.

class roboticstoolbox.blocks.mobile.Unicycle(*args: Any, **kwargs: Any)[source]

Bases: ContinuousBlock

UNICYCLE

Vehicle model with Unicycle kinematics.

Inputs:

2

Outputs:

1

States:

3

Port type

Port number

Types

Description

Input

0

float

\(v\), longitudinal velocity

Input

1

float

\(\omega\), turn rate

Output

0

ndarray(3)

\(\mathit{q} = (x, y, \theta)\), vehicle configuration

Unicycle kinematic model with velocity and steering inputs and vehicle configuration as output.

Various limits are applied to the inputs:

  • velocity limit speed_max

  • acceleration limit accel_max

  • steering limit steer_max

Seealso:

Unicycle Bicycle DiffSteer

__init__(w=1, speed_max=inf, accel_max=inf, steer_max=inf, x0=None, **blockargs)[source]
Parameters:
  • w (float, optional) – vehicle width, defaults to 1

  • speed_max (float, optional) – Velocity limit, defaults to math.inf

  • accel_max (float, optional) – maximum acceleration, defaults to math.inf

  • steer_max (float, optional) – maximum turn rate \(\omega\), defaults to math.inf

  • x0 (array_like(3), optional) – Inital state, defaults to [0,0,0]

  • blockargs (dict) – common Block options

class roboticstoolbox.blocks.mobile.DiffSteer(*args: Any, **kwargs: Any)[source]

Bases: ContinuousBlock

DIFFSTEER

Differential steer vehicle model

Inputs:

2

Outputs:

1

States:

3

Port type

Port number

Types

Description

Input

0

float

\(\omega_L\), left-wheel angular velocity (radians/sec).

Input

1

float

\(\omega_R\), right-wheel angular velocity (radians/sec).

Output

0

ndarray(3)

\(\mathit{q} = (x, y, \theta)\), vehicle configuration

Differential steering kinematic model with wheel velocity inputs and vehicle configuration as output.

Various limits are applied to the inputs:

  • velocity limit speed_max

  • acceleration limit accel_max

  • steering limit steer_max

Note

Wheel velocity is defined such that if both are positive the vehicle moves forward.

Seealso:

Diffsteer Bicycle Unicycle

__init__(w=1, R=1, speed_max=inf, accel_max=inf, steer_max=None, a=0, x0=None, **blockargs)[source]
Parameters:
  • w (float, optional) – vehicle width, defaults to 1

  • R (float, optional) – Wheel radius, defaults to 1

  • speed_max (float, optional) – Velocity limit, defaults to 1

  • accel_max (float, optional) – maximum acceleration, defaults to math.inf

  • steer_max (float, optional) – maximum steering rate, defaults to 1

  • x0 (array_like, optional) – Inital state, defaults to None

  • blockargs (dict) – common Block options

class roboticstoolbox.blocks.mobile.VehiclePlot(*args: Any, **kwargs: Any)[source]

Bases: GraphicsBlock

VEHICLEPLOT

Vehicle animation

Inputs:

1

Outputs:

0

States:

0

Port type

Port number

Types

Description

Input

0

float

\(\mathit{q} = (x, y, \theta)\), vehicle configuration

Create a vehicle animation similar to the figure below.

example of generated graphic

Example of vehicle display (animated). The label at the top is the block name.

AXES_POLICY = 'subplot'
TIMESTAMP = True
__init__(animation=None, path=None, labels=['X', 'Y'], square=True, init=None, scale='auto', shape='car', size=None, polyargs={}, **blockargs)[source]
Parameters:
  • animation (VehicleAnimation subclass, optional) – Graphical animation of vehicle, defaults to None

  • path (str or dict, optional) – linestyle to plot path taken by vehicle, defaults to None

  • labels (array_like(2) or list) – axis labels (xlabel, ylabel), defaults to [“X”,”Y”]

  • square (bool, optional) – Set aspect ratio to 1, defaults to True

  • init (callable, optional) – function to initialize graphics, defaults to None

  • scale (list or str, optional) – scale of plot, defaults to “auto”

  • shape (array_like, optional) – shape of vehicle, passed to animation, defaults to None

  • size (float or array_like, optional) – size of vehicle, passed to animation, defaults to None

  • polyargs (dict) – arguments passed to Animation.Polygon()

  • blockargs (dict) – common GraphicsBlock options

Note

  • The init function is called after the axes are initialized and can be used to draw application specific detail on the plot. In the example below, this is the dot and star.

  • If an animation object is not provided then a default polygon animation is created. It’s size and shape can be set by the size and shape parameters, which are passed to the animation object, or a dictionary of arguments polyargs which is passed to the default animation object.

  • A dynamic trail, showing path to date can be animated if the option path is set to a linestyle.