Bicycle#

module:

navground.core.kinematics

Bases: Kinematics

Bicycle kinematics.

Given linear and angular desired speeds \((v_{\mathrm{des}}, \omega_{\mathrm{des}})\), it computes linear and angular speeds that respect the upper bounds of the steering angle (\(|\alpha| \le \alpha_{\max}\)) so that \(\omega = v \frac{\tan \alpha}{l}\).

When \((v_{\mathrm{des}}, \omega_{\mathrm{des}})\) lie outside of the feasible set, i.e. \(|\omega_{\mathrm{des}}| > |v_{\mathrm{des}}| \frac{\tan \alpha_{\max}}{l}\), there are two simple ways to compute a feasible pair:

  1. reduce \(|\omega_{\mathrm{des}}|\), while keeping the same sign for \(\omega_{\mathrm{des}}\) and the same value for \(v_{\mathrm{des}}\),

  2. reduce \(|v_{\mathrm{des}}|\), while keeping the same sign for \(v_{\mathrm{des}}\) and the same value for \(\omega_{\mathrm{des}}\).

Parameter k control the computation:

  • k==0: uses #1,

  • k==1: uses #2,

  • 0 < k < 1: interpolates between the two methods.

Moreover, parameter use_velocity_norm can be used to ignore the direction of the desired velocity but just consider its norm as desired linear speed.

note This is not a subclass of WheeledKinematics. Although it has wheels, it also has a steering, therefore it is not completely determined by wheel speeds.

Registered properties:

Constructs a new instance.

Parameters:
  • max_speed – The maximal forwards speed

  • max_backward_speed – The maximal backward speed

  • axis – The distance between front and back wheels.

  • max_steering_angle – Maximal steering angle.

  • k

  • use_velocity_norm – Wheter to use the velocity norm instead of the projection on the x-axis.

Returns the nearest feasible steering angle

Parameters:

twist – The twist

Returns:

The angle in radians.

Computes a twist from linear speed and steering angle.

Linear speed and steering angle are clipped in the feasible range.

Parameters:
  • linear_speed – The linear speed

  • steering_angle – The steering angle

Returns:

The twist in relative frame.

Type:

float

Distance between front and back wheels.

Type:

float

Type:

float

The maximal backward speed.

Type:

float

The maximal steering angle.

Type:

float

The minimal steering radius.

Type:

bool

Whether to use the velocity norm instead of the projection on the x-axis.