Bicycle#
#include "navground/core/kinematics.h"
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:
reduce \(|\omega_{\mathrm{des}}|\), while keeping the same sign for \(\omega_{\mathrm{des}}\) and the same value for \(v_{\mathrm{des}}\),
reduce \(|v_{\mathrm{des}}|\), while keeping the same sign for \(v_{\mathrm{des}}\) and the same value for \(\omega_{\mathrm{des}}\).
Parameter get_k control the computation:
k==0
: uses #1,k==1
: uses #2,0 < k < 1
: interpolates between the two methods.
Moreover, parameter get_use_velocity_norm can be used to ignore the direction of the desired velocity but just consider its norm as desired linear speed.
Registered properties:
max_backward_speed
(float, get_max_backward_speed)axis
(float, get_axis)max_steering_angle
(float, get_max_steering_angle)k
(float, get_k)use_velocity_norm
(float, get_use_velocity_norm)
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.
Public Functions
Constructs a new instance.
- Parameters:
max_speed – [in] The maximal forwards speed
max_backward_speed – [in] The maximal backward speed
axis – [in] The distance between front and back wheels.
max_steering_angle – [in] Maximal steering angle.
k – [in] k.
use_velocity_norm – [in] Wheter to use the velocity norm instead of the projection on the x-axis.
Gets distance between front and back wheels.
- Returns:
The axis.
Sets distance between front and back wheels.
- Parameters:
value – [in] A positive value
Gets the maximal backward speed.
- Returns:
The axis.
Sets the maximal backward speed.
- Parameters:
value – [in] A positive value
Gets the maximal steering angle.
- Returns:
The angle in radians.
Sets the maximal steering angle.
- Parameters:
value – [in] A positive value in radians
Gets k.
- Returns:
k.
Gets whether to use the velocity norm instead of the projection on the x-axis.
- Returns:
True if is uses the velocity norm, False if it uses the projection.
Sets whether to use the velocity norm instead of the projection on the x-axis.
- Parameters:
value – [in] The desired value
Sets k.
- Parameters:
value – [in] A value in [0, 1]
Returns the degrees of freedom.
- Returns:
2
Returns the nearest feasible steering angle.
- Parameters:
twist – [in] The twist
- Returns:
The angle in radians.
Gets the minimal steering radius.
- Returns:
The minimal steering radius.
Computes a twist from linear speed and steering angle.
Linear speed and steering angle are clipped in the feasible range.
- Parameters:
linear_speed – [in] The linear speed
steering_angle – [in] The steering angle
- Returns:
The twist in relative frame.