Arena API

Corridor

class arena.Corridor.CorridorWorld(width, height, center, tilt=0, label=None, number=None)[source]

Corridor object for representation of free space between obstacles.

__init__(width, height, center, tilt=0, label=None, number=None)[source]

Constructor.

Parameters:
  • width (float) – corridor width

  • height (float) – corridor height

  • center (numpy.ndarray) – corridor center

  • tilt (float) – corridor tilt

  • label (string) – label of the corridor

  • number (int) – number of the corridor

get_corners()[source]

Compute and store the coordinates of the corridor corners.

The corners are returned and stored in counter-clockwise order:
  1. Top-right

  2. Bottom-right

  3. Bottom-left

  4. Top-left

Returns:

Array of corner coordinates (4x2).

Return type:

numpy.ndarray

shrink_with_direction(shrink_direction, offset)[source]

Shrink the corridor height by offset meters from either its head or tail.

Parameters:
  • shrink_direction (str) – Which end to shrink, either "head" or "tail".

  • offset (float) – Amount to reduce the height (m).

Returns:

New, shrunken CorridorWorld instance.

Return type:

CorridorWorld

shrink(margin)[source]

Create a new corridor with reduced width and height.

The corridor center and tilt remain unchanged, while both dimensions are reduced by 2 × margin.

Parameters:

margin (float) – Reduction margin in meters.

Returns:

New, shrunken CorridorWorld instance.

Return type:

CorridorWorld

update(**kwargs)[source]

Update one or more corridor attributes and automatically refresh all derived geometric parameters.

The method reinitializes the object using the existing attributes, updating only those provided in kwargs. This ensures that all dependent quantities (e.g. head, tail, corners, edge vectors) remain consistent.

Example:

corridor.update(width=5.0, tilt=np.pi/6)

Parameters:

kwargs (dict) – Attributes to update (e.g., width, height, center, tilt).

update_vector(tail, head, width, margin)[source]

Redefine the corridor using a new vector and dimensions.

The new corridor is defined by its head and tail points, a specified width, and an additional margin added to the computed height. The corridor center and tilt are derived automatically from the input vector.

Parameters:
  • tail (list[float] or numpy.ndarray) – Point defining the tail of the corridor vector.

  • head (list[float] or numpy.ndarray) – Point defining the head of the corridor vector.

  • width (float) – Corridor width in meters.

  • margin (float) – Additional margin (m) added to the computed height. The corridor center remains unchanged.

compute_relative_turn_direction(corridor2)[source]

Compute the relative turning direction between two corridors.

The direction is obtained from the 2D cross product between their unit vectors:

turn = x1·y2 - x2·y1

where:
  • turn > 0 → left turn

  • turn < 0 → right turn

  • turn ≈ 0 → straight (aligned)

Parameters:

corridor2 (CorridorWorld) – Second corridor to compare against.

Returns:

Turning direction indicator (1 = left, -1 = right, 0 = straight).

Return type:

float

rotate_corridor(angle)[source]

Return a new corridor that is a rotated version of the current corridor.

Parameters:

angle (float) – angle in radians

MotionPlanner

class arena.MotionPlanner.MotionPlanner(vehicle, corridor_list, start_pose=None, end_pose=None, relative_start_pose=None, relative_end_pose=None, waypoints=None)[source]

Analytically compute trajectories within corridors for different kinds of vehicles.

__init__(vehicle, corridor_list, start_pose=None, end_pose=None, relative_start_pose=None, relative_end_pose=None, waypoints=None)[source]

Constructor.

Parameters:
  • vehicle (Vehicle) – Vehicle model used for planning.

  • corridor_list (list[CorridorWorld]) – Ordered sequence of corridors.

  • start_pose (list[float] | numpy.ndarray) – Initial pose included in the first corridor. If not provided, it is computed automatically at a distance of 1.3 times the vehicle length from the midpoint of the back edge of the first corridor.

  • end_pose (list[float] | numpy.ndarray) – Goal pose included in the last corridor. If not provided, it is computed automatically at a distance of 1.3 times the vehicle length from the midpoint of the front edge of the last corridor.

  • waypoints (list[list[float]] | numpy.ndarray) – List of waypoints to make the trajectory pass through (used only if provided).

update(**kwargs)[source]

Update attributes of the MotionPlanner instance.

Keyword arguments correspond to existing attributes of the object. Attributes not found in the instance are ignored with a warning.

Example:

planner.update(start_pose=new_start, end_pose=new_end)

plot_planner_inputs(figure=None)[source]

Plot the corridors and start/end poses of the motion planner.

Parameters:

figure (matplotlib.figure.Figure, optional) – Matplotlib figure to plot on. If None, a new figure is created.

Returns:

The resulting matplotlib figure.

Return type:

matplotlib.figure.Figure

print_planner_inputs()[source]

Return a formatted string representation of the planner inputs.

compute_trajectory_analytical(obstacle_center=None, obstacle_radius=None)[source]

Compute the time-optimal trajectory from the start pose to the end pose.

Uses the analytical planner to generate a trajectory constrained within the specified corridors or waypoints.

Trajectory

class arena.Trajectory.Trajectory[source]

Base class for different types of trajectories.

__init__()[source]

Constructor. Trajectory class is the parent of all types of trajectories.

plot_path(figure=None, color='k', linestyle='solid', linewidth=2.5, label=None)[source]

Plot the path of the current trajectory.

This is a wrapper for plot_path_all_trajectories() that plots a single path using the provided visual style parameters.

Parameters:
  • figure (matplotlib.figure.Figure or None) – Figure to plot on. If None, a new one is created.

  • color (str) – Line color (default: 'k' for black).

  • linestyle (str) – Line style (default: 'solid').

  • linewidth (float) – Line width (default: 2.5).

  • label (str or None) – Label for the plotted line.

Returns:

The matplotlib figure used for plotting.

Return type:

matplotlib.figure.Figure

class arena.Trajectory.UnicycleTrajectory(time_grid, x, y, theta, forward_velocity, angular_velocity)[source]

Trajectory segment for a unicycle-type vehicle.

Represents the evolution of position, heading, and control inputs (forward and angular velocity) along a given time grid.

__init__(time_grid, x, y, theta, forward_velocity, angular_velocity)[source]

Initialize a unicycle trajectory instance.

Parameters:
  • time_grid (list[float] or numpy.ndarray) – Time grid of the trajectory.

  • x (list[float] or numpy.ndarray) – x-coordinates along the trajectory.

  • y (list[float] or numpy.ndarray) – y-coordinates along the trajectory.

  • theta (list[float] or numpy.ndarray) – Heading angles along the trajectory.

  • forward_velocity (list[float] or numpy.ndarray) – Forward velocity profile over the time grid.

  • angular_velocity (list[float] or numpy.ndarray) – Angular velocity profile over the time grid.

class arena.Trajectory.UnicycleTrajectoryOptimal(time_grid, x, y, theta, v, omega, control_time_grid, control_x, control_y, control_theta, control_forward_velocity, control_angular_velocity, total_time, x_initial_guess=None, y_initial_guess=None, theta_initial_guess=None, v_initial_guess=None, omega_initial_guess=None, time_grid_initial_guess=None, sampler=None, gist=None)[source]

Optimal trajectory for a unicycle-type vehicle.

Extends UnicycleTrajectory with additional data from an optimal control problem (OCP) solution, including control profiles, initial guesses, and solver metadata.

__init__(time_grid, x, y, theta, v, omega, control_time_grid, control_x, control_y, control_theta, control_forward_velocity, control_angular_velocity, total_time, x_initial_guess=None, y_initial_guess=None, theta_initial_guess=None, v_initial_guess=None, omega_initial_guess=None, time_grid_initial_guess=None, sampler=None, gist=None)[source]

Initialize an optimal unicycle trajectory object.

Parameters:
  • time_grid (list[float] or numpy.ndarray) – Time grid of the state trajectory.

  • x (list[float] or numpy.ndarray) – x-coordinates of the trajectory.

  • y (list[float] or numpy.ndarray) – y-coordinates of the trajectory.

  • theta (list[float] or numpy.ndarray) – Heading angles along the trajectory.

  • v (list[float] or numpy.ndarray) – Forward velocity along the trajectory.

  • omega (list[float] or numpy.ndarray) – Angular velocity along the trajectory.

  • control_time_grid (list[float] or numpy.ndarray) – Time grid for control inputs.

  • control_x (list[float] or numpy.ndarray) – x-coordinates of control points.

  • control_y (list[float] or numpy.ndarray) – y-coordinates of control points.

  • control_theta (list[float] or numpy.ndarray) – Heading angles at control points.

  • control_forward_velocity (list[float] or numpy.ndarray) – Forward velocity controls.

  • control_angular_velocity (list[float] or numpy.ndarray) – Angular velocity controls.

  • total_time (float) – Total duration of the trajectory (s).

  • x_initial_guess (list[float] or numpy.ndarray) – Initial guess for x positions (optional).

  • y_initial_guess (list[float] or numpy.ndarray) – Initial guess for y positions (optional).

  • theta_initial_guess (list[float] or numpy.ndarray) – Initial guess for heading angles.

  • v_initial_guess (list[float] or numpy.ndarray) – Initial guess for forward velocity.

  • omega_initial_guess (list[float] or numpy.ndarray) – Initial guess for angular velocity.

  • time_grid_initial_guess (list[float] or numpy.ndarray) – Initial guess for the time grid.

  • sampler (object or None) – Sampling or interpolation object (optional).

  • gist (object or None) – Additional solver or metadata information.

class arena.Trajectory.CurvilinearArcUnicycle(xc, yc, x0, y0, theta0, xf, yf, thetaf, radius, turn_direction, v, omega, unicycle, t0=0, samples_number=50)[source]

Curvilinear arc trajectory segment for a unicycle-type vehicle.

__init__(xc, yc, x0, y0, theta0, xf, yf, thetaf, radius, turn_direction, v, omega, unicycle, t0=0, samples_number=50)[source]

Constructor. Trajectory class is the parent of all types of trajectories.

add_time_offset(offset)[source]

Add a time offset to the trajectory.

Parameters:

offset (float) – time offset to add

change_theta0(new_theta0)[source]

Update the initial heading of the trajectory.

Keeps the same internal rotation angle while updating the trajectory orientation and poses accordingly.

Parameters:

new_theta0 (float) – New initial heading angle (radians).

resample(new_samples_number)[source]

Resample the trajectory with a new number of samples.

Updates the path coordinates, heading, velocity, and time grid.

Parameters:

new_samples_number (int) – Desired number of trajectory samples.

reverse()[source]

Reverse the trajectory direction.

Flips the start and end orientations, inverts the motion direction, and updates angular quantities and trajectory profiles accordingly.

plot_circle(figure=None, color='b', linestyle='dashed', linewidth=0.5)[source]

Plot the circle associated with this trajectory/vehicle.

class arena.Trajectory.LinearSegmentUnicycle(x0, y0, xf, yf, theta, v, unicycle=None, t0=0, samples_number=10)[source]

Linear segment trajectory segment for a unicycle-type vehicle.

__init__(x0, y0, xf, yf, theta, v, unicycle=None, t0=0, samples_number=10)[source]

Initialize attributes of the linear segment. :param x0: initial x position :type x0: float :param y0: initial y position :type y0: float :param xf: final x position :type xf: float :param yf: final y position :type yf: float :param theta: heading angle :type theta: float :param v: forward velocity :type v: float :param unicycle: unicycle vehicle object :type unicycle: Unicycle :param t0: initial time :type t0: float :param samples_number: number of samples :type samples_number: int

add_time_offset(offset)[source]

Add a time offset to the trajectory.

Parameters:

offset (float) – time offset to add

change_theta(new_theta)[source]

Update the heading of the trajectory. :param new_theta: New heading angle (radians). :type new_theta: float

resample(new_samples_number)[source]

Resample the trajectory with a new number of samples.

Updates the path coordinates, heading, velocity, and time grid.

Parameters:

new_samples_number (int) – Desired number of trajectory samples.

reverse()[source]

Reverse the trajectory direction.

Flips the start and end orientations, inverts the motion direction, and updates angular quantities and trajectory profiles accordingly.

class arena.Trajectory.TurnOnTheSpot(x, y, theta0, thetaf, omega, unicycle=None, t0=0, samples_number=10)[source]

Turn on-the-spot trajectory segment for a unicycle-type vehicle.

__init__(x, y, theta0, thetaf, omega, unicycle=None, t0=0, samples_number=10)[source]

Initialize attributes of the turn on-the-spot segment. :param x: x position :type x: float :param y: y position :type y: float :param theta0: initial heading angle :type theta0: float :param thetaf: final heading angle :type thetaf: float :param omega: angular velocity :type omega: float :param unicycle: unicycle vehicle object :type unicycle: Unicycle :param t0: initial time :type t0: float :param samples_number: number of samples :type samples_number: int

add_time_offset(offset)[source]

Add a time offset to the trajectory.

Parameters:

offset (float) – time offset to add

change_theta0(new_theta0)[source]

Update the initial heading of the trajectory.

Keeps the same internal rotation angle while updating the overall trajectory orientation and poses accordingly.

Parameters:

new_theta0 (float) – New initial heading angle (radians).

resample(new_samples_number)[source]

Resample the trajectory with a new number of samples.

Updates the path coordinates, heading, velocity, and time grid.

Parameters:

new_samples_number (int) – Desired number of trajectory samples.

reverse()[source]

Reverse the trajectory direction.

Flips the start and end orientations, inverts the motion direction, and updates angular quantities and trajectory profiles accordingly.

class arena.Trajectory.BackwardArc(xc, yc, x0, y0, theta0, xf, yf, thetaf, radius, turn_direction, v, omega, bicycle, t0=0, samples_number=10)[source]

Backward curvilinear arc trajectory segment for a unicycle-type vehicle.

__init__(xc, yc, x0, y0, theta0, xf, yf, thetaf, radius, turn_direction, v, omega, bicycle, t0=0, samples_number=10)[source]

Initialize attributes of the backward arc. :param xc: x coordinate of the circle center :type xc: float :param yc: y coordinate of the circle center :type yc: float :param x0: initial x position :type x0: float :param y0: initial y position :type y0: float :param theta0: initial heading angle :type theta0: float :param xf: final x position :type xf: float :param yf: final y position :type yf: float :param thetaf: final heading angle :type thetaf: float :param radius: radius of the arc :type radius: float :param turn_direction: turn direction (-1 for right, +1 for left) :type turn_direction: int :param v: forward velocity :type v: float :param omega: angular velocity :type omega: float :param bicycle: bicycle vehicle object :type bicycle: Bicycle :param t0: initial time :type t0: float :param samples_number: number of samples :type samples_number: int

add_time_offset(offset)[source]

Add a time offset to the trajectory.

Parameters:

offset (float) – time offset to add

change_theta0(new_theta0)[source]

Change the initial heading angle of the trajectory. Update the initial heading of the trajectory. Keeps the same internal rotation angle while updating the overall trajectory orientation and poses accordingly. :param new_theta0: New initial heading angle (radians). :type new_theta0: float

resample(new_samples_number)[source]

Resample the trajectory with a new number of samples.

Updates the path coordinates, heading, velocity, and time grid.

Parameters:

new_samples_number (int) – Desired number of trajectory samples.

reverse()[source]

Reverse the trajectory direction.

Flips the start and end orientations, inverts the motion direction, and updates angular quantities and trajectory profiles accordingly.

plot_circle(figure=None, color='b', linestyle='dashed', linewidth=0.5)[source]

Plot the circle associated with this trajectory/vehicle.

class arena.Trajectory.BicycleTrajectory(time_grid, x, y, theta, forward_velocity, steering_angle)[source]

Trajectory object for representation of piece of trajectory of a unicycle vehicle.

__init__(time_grid, x, y, theta, forward_velocity, steering_angle)[source]

Constructor.

Parameters:
  • time_grid (list of floats or numpy.ndarray) – time grid of the trajectory

  • x (list of floats or numpy.ndarray) – vector storing the x coordinates of the path in the provided time grid

  • y (list of floats or numpy.ndarray) – vector storing the y coordinates of the path in the provided time grid

  • theta (list of floats or numpy.ndarray) – vector storing the heading of the unicycle theta along the path in the provided time grid

  • forward_velocity (list of floats or numpy.ndarray) – vector storing the forward velocity of the unicycle in the provided time grid

  • steering_angle (list of floats or numpy.ndarray) – vector storing the steering rate of the unicycle in the provided time grid

class arena.Trajectory.BicycleTrajectoryOptimal(time_grid, x, y, theta, v, delta, control_time_grid, control_x, control_y, control_theta, control_forward_velocity, control_steering_angle, x_initial_guess, y_initial_guess, total_time)[source]

Optimal trajectory object for representation of piece of trajectory of a bicycle vehicle.

__init__(time_grid, x, y, theta, v, delta, control_time_grid, control_x, control_y, control_theta, control_forward_velocity, control_steering_angle, x_initial_guess, y_initial_guess, total_time)[source]

Constructor.

Parameters:
  • time_grid (list of floats or numpy.ndarray) – time grid of the trajectory

  • x (list of floats or numpy.ndarray) – vector storing the x coordinates of the path in the provided time grid

  • y (list of floats or numpy.ndarray) – vector storing the y coordinates of the path in the provided time grid

  • theta (list of floats or numpy.ndarray) – vector storing the heading of the unicycle theta along the path in the provided time grid

  • forward_velocity (list of floats or numpy.ndarray) – vector storing the forward velocity of the unicycle in the provided time grid

  • steering_angle (list of floats or numpy.ndarray) – vector storing the steering rate of the unicycle in the provided time grid

Vehicle

class arena.Vehicle.Vehicle[source]

Vehicle object for representation of all types of vehicles.

__init__()[source]

Constructor. Vehicle class is the parent of all types of vehicles.

copy()[source]

Generate a copy of the vehicle object.

Returns:

copy of the vehicle

Return type:

object of vehicle class

simulate_one_step(y0, u0, dt)[source]

Simulate the dynamics of the vehicle one step forward with Runge-Kutta4 simulation scheme.

Parameters:
  • y0 (numpy.ndarray) – initial state

  • u0 (numpy.ndarray) – control inputs

Dt:

time interval

Type:

float

Return y:

final state after one simulation step

Return type:

numpy.ndarray

simulate_trajectory(initial_state, input_trajectory, time_interval)[source]

Simulate the vehicle dynamics N steps forward using a 4th-order Runge–Kutta scheme.

The number of simulation steps N is inferred from the input trajectory.

Parameters:
  • initial_state (numpy.ndarray) – Initial vehicle state vector.

  • input_trajectory (numpy.ndarray) – Control input sequence (shape: [nu, N]).

  • time_interval (float) – Time interval.

Returns:

The full state trajectory, including the initial state.

Return type:

numpy.ndarray

class arena.Vehicle.Unicycle(state=array([0., 0., 0.]), width=0.43, length=0.508, v_max=0.5, v_min=-0.5, omega_max=0.5, omega_min=-0.5, model=None)[source]

Unicycle vehicle model.

Inherits from the Vehicle base class and represents a simple nonholonomic robot with a single wheel or equivalent differential drive. The unicycle configuration is described by the state vector [x, y, theta]^T, where:

  • x and y are the planar coordinates of the vehicle position.

  • theta is the vehicle orientation in radians.

The kinematic model follows:

xxdot = v * cos(theta) ydot = v * sin(theta) thetadot = omega

where v is the linear velocity and omega is the angular velocity.

__init__(state=array([0., 0., 0.]), width=0.43, length=0.508, v_max=0.5, v_min=-0.5, omega_max=0.5, omega_min=-0.5, model=None)[source]

Initialize a Unicycle object.

All arguments are optional. If no model name is provided, the unicycle is initialized with default parameters corresponding to a Jackal robot.

Parameters:
  • state (numpy.ndarray) – State vector of the unicycle [x, y, theta]^T. Defaults to zeros.

  • width (float) – Width of the unicycle in meters. Defaults to 0.430 m.

  • length (float) – Length of the unicycle in meters. Defaults to 0.508 m.

  • v_max (float) – Maximum forward velocity (m/s). Defaults to 0.5.

  • v_min (float) – Minimum forward velocity (m/s). Defaults to −0.5.

  • omega_max (float) – Maximum angular velocity (rad/s). Defaults to 0.5.

  • omega_min (float) – Minimum angular velocity (rad/s). Defaults to −0.5.

  • model (str, optional) – Name of the model defined in unicycle_library.yaml. If provided, the parameters are loaded from that file.

get_pose()[source]

Returns the state of the unicycle.

Return self.state:

state of the unicycle

Return type:

numpy.ndarray

update(**kwargs)[source]

Update attributes of the MotionPlanner instance.

Keyword arguments correspond to existing attributes of the object. Attributes not found in the instance are ignored with a warning. If either v_max or omega_max is updated, max_radius is automatically recalculated as abs(v_max / omega_max).

Example:

planner.update(start_pose=new_start, end_pose=new_end, v_max=0.6)

dynamics(x, u)[source]

Compute the time derivatives of the unicycle state.

Applies the unicycle kinematic model to compute the rate of change of the state vector given the current state and control inputs.

Parameters:
  • x (numpy.ndarray or list[float]) – Current state vector [x, y, theta].

  • u (numpy.ndarray or list[float]) – Control input vector [v, omega].

Returns:

State derivatives [x_dot, y_dot, theta_dot] as a NumPy array.

Return type:

numpy.ndarray

class arena.Vehicle.Bicycle(state=array([0., 0., 0.]), width=0.43, length=0.508, wheelbase=0.4, v_max=0.5, v_min=-0.5, delta_max=0.5, delta_min=-0.5, model=None)[source]

Bicycle object.

Inherits from the Vehicle class. The bicycle model represents a vehicle with two wheels — a steerable front wheel and a fixed rear wheel.

Its configuration is defined by the state vector [x, y, theta]^T, where:
  • x and y are the coordinates of the rear wheel contact point.

  • theta is the vehicle orientation (the angle of the line connecting the wheel centers).

The kinematic model is:

xdot = v * cos(theta), ydot = v * sin(theta), thetadot = v * tan(theta) / L

where v is the forward velocity, delta is the steering angle, and L is the wheelbase.

__init__(state=array([0., 0., 0.]), width=0.43, length=0.508, wheelbase=0.4, v_max=0.5, v_min=-0.5, delta_max=0.5, delta_min=-0.5, model=None)[source]

Initialize a Bicycle object.

All arguments are optional. If no model name is provided, the bicycle is initialized with default parameters corresponding to a Jackal robot.

Parameters:
  • state (numpy.ndarray) – State vector of the bicycle [x, y, theta]^T. Defaults to zeros.

  • width (float) – Width of the bicycle in meters. Defaults to 0.430 m.

  • length (float) – Length of the bicycle in meters. Defaults to 0.508 m.

  • wheelbase (float) – Distance between front and rear axles (m). Defaults to 0.4.

  • v_max (float) – Maximum forward velocity (m/s). Defaults to 0.5.

  • v_min (float) – Minimum forward velocity (m/s). Defaults to −0.5.

  • delta_max (float) – Maximum steering angle (rad). Defaults to 0.5.

  • delta_min (float) – Minimum steering angle (rad). Defaults to −0.5.

  • model (str, optional) – Name of the model defined in bicycle_library.yaml. If provided, the parameters are loaded from that file.

get_pose()[source]

Returns the state of the bicycle.

Return self.state:

state of the bicycle

Return type:

numpy.ndarray

update(**kwargs)[source]

Update attributes of the Bicycle instance.

Keyword arguments correspond to existing attributes of the object. Attributes not found in the instance are ignored with a warning.

If any of the following attributes are updated:
  • v_max

  • delta_max

  • wheelbase

then the dependent parameters omega_max, omega_min, and max_radius are automatically recalculated as:

omega_max = v_max * tan(delta_max) / wheelbase omega_min = -omega_max max_radius = abs(wheelbase / tan(delta_max))

Example:

bicycle.update(v_max=1.0, delta_max=0.6)

dynamics(x, u)[source]

Compute the time derivatives of the bicycle state.

Applies the bicycle kinematic model to compute the rate of change of the state vector given the current state and control inputs.

Parameters:
  • x (numpy.ndarray or list[float]) – Current state vector [x, y, theta].

  • u (numpy.ndarray or list[float]) – Control input vector u = [v, delta].

Returns:

State derivatives [xdot, ydot, thetadot] as a NumPy array.

Return type:

numpy.ndarray

class arena.Vehicle.Bicycle_Acceleration(state=array([0., 0., 0., 0., 0.]), width=1.8, length_front=3.0, length_rear=1.5, wheelbase=2.7, v_max=30.0, v_min=0.0, a_max=3.0, a_min=-6.0, delta_max=0.6, delta_min=-0.6, delta_dot_max=0.6, delta_dot_min=-0.6, model=None)[source]

Kinematic bicycle model with acceleration and steering rate limits.

Inherits from the Vehicle base class and represents a car-like vehicle with front-wheel steering and bounded acceleration and steering rate dynamics.

The vehicle configuration is defined by the state vector [x, y, theta, v, delta]^T, where:

  • x, y are the coordinates of the rear wheel contact point (m),

  • theta is the vehicle orientation (rad),

  • v is the longitudinal velocity (m/s),

  • delta is the front wheel steering angle (rad).

The kinematic model follows:

xdot = v * cos(theta) ydot = v * sin(theta) thetadot = v * tan(delta) / L vdot = a deltadot = deltadot

where:
  • L is the wheelbase,

  • a is the longitudinal acceleration,

  • deltadot is the steering rate.

The model includes bounds on velocity, acceleration, steering angle, and steering rate to represent real vehicle constraints.

__init__(state=array([0., 0., 0., 0., 0.]), width=1.8, length_front=3.0, length_rear=1.5, wheelbase=2.7, v_max=30.0, v_min=0.0, a_max=3.0, a_min=-6.0, delta_max=0.6, delta_min=-0.6, delta_dot_max=0.6, delta_dot_min=-0.6, model=None)[source]

Initialize a Bicycle_Acceleration object.

All arguments are optional. If no model name is provided, the vehicle is initialized with default parameters representing a passenger car.

Parameters:
  • state (numpy.ndarray) – Vehicle state vector [x, y, theta, v, delta]. Defaults to zeros.

  • width (float) – Vehicle width in meters. Defaults to 1.8 m.

  • length_front (float) – Distance from vehicle CG to front axle (m).

  • length_rear (float) – Distance from vehicle CG to rear axle (m).

  • wheelbase (float) – Distance between front and rear axles (m).

  • v_max (float) – Maximum forward velocity (m/s). Defaults to 30.

  • v_min (float) – Minimum forward velocity (m/s). Defaults to 0.

  • a_max (float) – Maximum acceleration (m/s²). Defaults to 3.

  • a_min (float) – Minimum acceleration (m/s²). Defaults to -6.

  • delta_max (float) – Maximum steering angle (rad). Defaults to 0.6.

  • delta_min (float) – Minimum steering angle (rad). Defaults to -0.6.

  • delta_dot_max (float) – Maximum steering rate (rad/s). Defaults to 0.6.

  • delta_dot_min (float) – Minimum steering rate (rad/s). Defaults to -0.6.

  • model (str, optional) – Optional model name from bicycle_acceleration_library.yaml. If provided, parameters are loaded from that file.

get_pose()[source]

Returns the state of the bicycle.

Return self.state:

state of the bicycle

Return type:

numpy.ndarray

update(**kwargs)[source]

Update attributes of the Bicycle_Acceleration instance.

Keyword arguments correspond to existing attributes of the object. Attributes not found in the instance are ignored with a warning.

If any of the following attributes are updated:
  • v_max

  • delta_max

  • wheelbase

then the dependent parameters omega_max, omega_min, and max_radius are automatically recalculated as:

omega_max = v_max * tan(delta_max) / wheelbase omega_min = -omega_max max_radius = abs(wheelbase / tan(delta_max))

Example:

car.update(v_max=20.0, delta_max=0.5, a_max=4.0)

Parameters:

kwargs (dict) – Keyword arguments matching instance attributes.

dynamics(x, u)[source]

Compute the time derivatives of the bicycle-acceleration model state.

Applies the extended kinematic bicycle model to compute the rate of change of the vehicle state, including longitudinal acceleration and steering rate as control inputs.

The state vector is defined as x = [x, y, theta, v, delta], where:
  • x and y are the coordinates of the rear wheel contact point (m),

  • theta is the vehicle orientation (rad),

  • v is the longitudinal velocity (m/s),

  • delta is the steering angle (rad).

The control input vector is u = [a, delta_dot], where:
  • a is the longitudinal acceleration (m/s²),

  • delta_dot is the steering rate (rad/s).

The kinematic equations are:

xdot = v * cos(theta) ydot = v * sin(theta) thetadot = v * tan(delta) / L vdot = a deltadot = delta_dot

where L is the wheelbase.

Parameters:
  • x (numpy.ndarray or list[float]) – Current state vector [x, y, theta, v, delta].

  • u (numpy.ndarray or list[float]) – Control input vector [a, delta_dot].

Returns:

Time derivatives of the states [xdot, ydot, thetadot, vdot, deltadot].

Return type:

numpy.ndarray