Two wheels differential drive with dynamic constraints#

#include "navground/core/kinematics.h"
class DynamicTwoWheelsDifferentialDriveKinematics : public navground::core::TwoWheelsDifferentialDriveKinematics#

Two differential drive wheels (left, right) (e.g., a wheelchair) with acceleration limits due to limited motor torque.

The two motors have the same maximal torque.

Registered properties:

Public Functions

inline DynamicTwoWheelsDifferentialDriveKinematics(ng_float_t max_speed = Kinematics::inf, ng_float_t wheel_axis = 1, ng_float_t max_angular_speed = Kinematics::inf, ng_float_t max_forward_speed = Kinematics::inf, ng_float_t max_backward_speed = 0, ng_float_t max_acceleration = Kinematics::inf, ng_float_t moi = 1)#

Constructs a new instance.

Parameters:
  • max_speed[in] The maximal wheel speed

  • wheel_axis[in] The wheel axis (i.e., the distance between the wheels)

  • max_angular_speed[in] The maximal angular speed, that is also limited by the 2 * max_speed / axis, if the axis is positive.

  • max_forward_speed[in] The maximal linear speed when moving forwards (set to negative or infinite to leave unconstrained)

  • max_backward_speed[in] The maximal linear speed when moving backwards (set to negative or infinite to leave unconstrained)

  • max_acceleration[in] The maximal linear body acceleration

  • moi[in] The scaled moment of inertial (moi = I / (mass * axis^2 / 8)) Equal to 1 for an homogeneous disc of diameter wheel_axis.

inline ng_float_t get_moi() const#

Gets the scaled moment of inertial.

It is equal to 1 for an homogeneous of disc of diameter TwoWheelsDifferentialDriveKinematics::get_wheel_axis. Lower for when weight is shifted towards the center.

Returns:

A positive value

inline void set_moi(ng_float_t value)#

Sets the scaled moment of inertial.

It is equal to for an homogeneous of disc of diameter TwoWheelsDifferentialDriveKinematics::get_wheel_axis. Lower for when weight is shifted towards the center.

Parameters:

value[in] A positive value

inline ng_float_t get_max_acceleration() const#

Gets the maximal (body) acceleration.

Returns:

The acceleration.

inline void set_max_acceleration(ng_float_t value)#

Sets the maximal (body) acceleration.

Parameters:

value[in] A positive value

ng_float_t get_max_angular_acceleration() const#

Gets the maximal (body) angular acceleration.

Returns:

The angular acceleration.

void set_max_angular_acceleration(ng_float_t value)#

Sets the maximal (body) angular acceleration.

Parameters:

value[in] A positive value

std::vector<ng_float_t> wheel_torques(const Twist2 &value, const Twist2 &current, ng_float_t time_step) const#

Computes the wheel torques required to accelerate over a time step.

Parameters:
  • value[in] The target value

  • current[in] The current value

  • time_step[in] The time step

Returns:

{left, right} wheel torques. May not be feasible

Twist2 twist_from_wheel_torques(const std::vector<ng_float_t> &values, const Twist2 &current, ng_float_t time_step) const#

Applies wheel torques to accelerate a twist over a time step.

        Does not check the motor torques are feasible.
Parameters:
  • values[in] The motor torques

  • current[in] The current twist

  • time_step[in] The time step

Returns:

The accelerated twist.

inline ng_float_t get_max_wheel_torque() const#

Gets the maximal [scaled] wheel torque.

Returns:

The maximal wheel torque (in acceleration units)