|
libstp
Robotics library for Botball
|
#include <mecanum.hpp>
Public Member Functions | |
| MecanumKinematics (hal::motor::IMotor *front_left_motor, hal::motor::IMotor *front_right_motor, hal::motor::IMotor *back_left_motor, hal::motor::IMotor *back_right_motor, double wheelbase, double trackWidth, double wheelRadius, foundation::VelocityCommandGain velocityCommandGain={}) | |
| ~MecanumKinematics () override=default | |
| std::size_t | wheelCount () const override |
| MotorCommands | applyCommand (const foundation::ChassisVelocity &cmd, double dt) override |
| foundation::ChassisVelocity | estimateState () const override |
| void | hardStop () override |
| bool | supportsLateralMotion () const override |
| void | resetEncoders () override |
| double | getWheelRadius () const override |
| Get the wheel radius used by this kinematics model. | |
| void | setMaxWheelSpeed (double max_wheel_speed) |
| double | getMaxWheelSpeed () const |
| double | maxYawRateForArcRadius (double radius_m, bool) const override |
| std::vector< hal::motor::IMotor * > | getMotors () override |
| StmOdometryConfig | getStmOdometryConfig () override |
| void | setVelocityCommandGains (double gx, double gy, double gw) override |
| std::array< double, 3 > | getVelocityCommandGains () const override |
| void | applyPowerCommand (const foundation::ChassisVelocity &direction, int power_percent) override |
| Public Member Functions inherited from libstp::kinematics::IKinematics | |
| virtual | ~IKinematics ()=default |
Four-wheel mecanum implementation of IKinematics.
The model uses the shared LibSTP body-frame convention: +x forward, +y right, +wz counter-clockwise.
Definition at line 17 of file mecanum.hpp.
| libstp::kinematics::mecanum::MecanumKinematics::MecanumKinematics | ( | hal::motor::IMotor * | front_left_motor, |
| hal::motor::IMotor * | front_right_motor, | ||
| hal::motor::IMotor * | back_left_motor, | ||
| hal::motor::IMotor * | back_right_motor, | ||
| double | wheelbase, | ||
| double | trackWidth, | ||
| double | wheelRadius, | ||
| foundation::VelocityCommandGain | velocityCommandGain = {} ) |
| front_left_motor | Non-owning pointer to the front-left motor. |
| front_right_motor | Non-owning pointer to the front-right motor. |
| back_left_motor | Non-owning pointer to the back-left motor. |
| back_right_motor | Non-owning pointer to the back-right motor. |
| wheelbase | Front-to-back axle spacing in meters. |
| trackWidth | Left-to-right wheel spacing in meters. |
| wheelRadius | Radius of each drive wheel in meters. |
| velocityCommandGain | Per-axis velocity-command gain (identity by default); folded into the STM32 forward kinematics to compensate drivetrain efficiency. Calibrated by the autotune velocity phase. |
|
overridedefault |
|
overridevirtual |
Convert chassis velocity into front-left, front-right, back-left, back-right wheel speeds.
Implements libstp::kinematics::IKinematics.
|
overridevirtual |
Command motors at raw open-loop power using mecanum inverse kinematics for direction.
Implements libstp::kinematics::IKinematics.
|
nodiscardoverridevirtual |
Recover chassis velocity from the four measured wheel speeds.
Implements libstp::kinematics::IKinematics.
|
inlinenodiscard |
Definition at line 81 of file mecanum.hpp.
|
nodiscardoverridevirtual |
Return the underlying motors in front-left, front-right, back-left, back-right order.
Implements libstp::kinematics::IKinematics.
|
nodiscardoverridevirtual |
Implements libstp::kinematics::IKinematics.
|
nodiscardoverridevirtual |
Reimplemented from libstp::kinematics::IKinematics.
|
inlinenodiscardoverridevirtual |
Get the wheel radius used by this kinematics model.
Implements libstp::kinematics::IKinematics.
Definition at line 77 of file mecanum.hpp.
|
overridevirtual |
Brake all four drive motors immediately.
Implements libstp::kinematics::IKinematics.
|
inlinenodiscardoverridevirtual |
Mecanum wheel speed is (|vx| + |vy| + |wz| * (l + w)/2) / r; on an arc (v = omega * radius, one translational axis) the fastest wheel runs at omega * (radius + (l + w)/2) / r — cap omega so it stays inside the wheel-speed limit. Same lever for drive and strafe arcs.
Reimplemented from libstp::kinematics::IKinematics.
Definition at line 89 of file mecanum.hpp.
|
overridevirtual |
Clear encoder history in all four MotorAdapter instances.
Implements libstp::kinematics::IKinematics.
|
inline |
Set max wheel speed (rad/s) for desaturation. 0 = disabled.
Definition at line 80 of file mecanum.hpp.
|
overridevirtual |
Set/get the per-axis velocity-command gain [vx, vy, wz].
Reimplemented from libstp::kinematics::IKinematics.
|
nodiscardoverridevirtual |
Mecanum drivetrains can command lateral motion directly.
Implements libstp::kinematics::IKinematics.
|
nodiscardoverridevirtual |
Always returns 4.
Implements libstp::kinematics::IKinematics.