Two wheels differential drive#

#include "navground/core/kinematics.h"
class TwoWheelsDifferentialDriveKinematics : public virtual navground::core::Kinematics, public navground::core::WheeledKinematics#

Two differential drive wheels (left, right) (e.g., a wheelchair) with a physical maximal wheel speed, and software-limited forward/backwards speeds.

It implements two types of kinematics constrains:

  • a maximal wheel speed that adds a linear coupling between linear and angular speed (e.g., the robot can move at maximal linear speed only straights) (same as TwoWheelsDifferentialDriveKinematics)

  • a controller that clamps linear and angular speed inside a box: these constrains when the related bounds are set to negative values.

Registered properties:

Subclassed by navground::core::DynamicTwoWheelsDifferentialDriveKinematics

Public Functions

inline explicit TwoWheelsDifferentialDriveKinematics(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)#

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)

inline ng_float_t get_wheel_axis() const#

Gets the wheel axis.

Returns:

The axis.

inline void set_wheel_axis(ng_float_t value)#

Sets the wheel axis.

Parameters:

value[in] A positive value

inline virtual unsigned dof() const override#

Returns the degrees of freedom.

Returns:

2

inline bool can_move_backwards() const#

Whether the agent can move backwards.

Returns:

True if moving backwards is possible.

inline bool can_move_forwards() const#

Whether the agent can move forwards.

Returns:

True if moving forwards is possible.

inline ng_float_t get_max_forward_speed() const#

Gets the maximal linear speed when moving forwards.

Returns:

The maximal speed.

inline void set_max_forward_speed(ng_float_t value)#

Sets the maximal speed when moving forwards.

Parameters:

value[in] The desired value. A negative number is interpreted as +infinite.

inline ng_float_t get_max_backward_speed() const#

Gets the maximal linear speed when moving backwards.

Returns:

The maximal speed.

inline void set_max_backward_speed(ng_float_t value)#

Sets the maximal speed when moving backwards.

Parameters:

value[in] The desired value. A negative number is interpreted as +infinite.

virtual Twist2 twist(const WheelSpeeds &speeds) const override#

See WheeledKinematics::twist.

Parameters:

speeds[in] The wheel speeds in the order {left, right}

Returns:

The corresponding twist

virtual WheelSpeeds wheel_speeds(const Twist2 &twist) const override#

See WheeledKinematics::wheel_speeds.

Parameters:

twist[in] The twist

Returns:

The corresponding wheel speeds in the order {left, right}