|
libstp
Robotics library for Botball
|
#include <drive.hpp>
Public Member Functions | |
| Drive (std::unique_ptr< kinematics::IKinematics > kinematics, const ChassisVelocityControlConfig &vel_config, hal::imu::IIMU &imu) | |
| void | setVelocity (const foundation::ChassisVelocity &v_body) |
| kinematics::MotorCommands | update (double dt) |
| foundation::ChassisVelocity | estimateState () const |
| std::size_t | wheelCount () const |
| void | softStop () |
| void | hardStop () |
| void | setVelocityControlConfig (const ChassisVelocityControlConfig &config) |
| const ChassisVelocityControlConfig & | getVelocityControlConfig () const |
| void | resetVelocityControllers () |
| kinematics::IKinematics & | getKinematics () |
| const kinematics::IKinematics & | getKinematics () const |
| double | getWheelRadius () const |
| std::vector< hal::motor::IMotor * > | getMotors () |
| hal::imu::IIMU & | getImu () |
| const hal::imu::IIMU & | getImu () const |
| void | applyPowerCommand (const foundation::ChassisVelocity &direction, int power_percent) |
Chassis-space drive controller.
Drive closes the loop on desired body velocity by combining feedback from a kinematics model and an IMU, then forwarding corrected commands to the drivetrain-specific IKinematics implementation.
| libstp::drive::Drive::Drive | ( | std::unique_ptr< kinematics::IKinematics > | kinematics, |
| const ChassisVelocityControlConfig & | vel_config, | ||
| hal::imu::IIMU & | imu ) |
| kinematics | Owned drivetrain kinematics implementation. |
| vel_config | Initial per-axis velocity-controller gains. |
| imu | IMU used for yaw-rate feedback. |
|
inline |
|
nodiscard |
Estimate current body-frame velocity using kinematics plus the last IMU yaw rate.
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
| void libstp::drive::Drive::hardStop | ( | ) |
Immediately clear controller state and brake the drivetrain.
| void libstp::drive::Drive::resetVelocityControllers | ( | ) |
Clear integrator and derivative history in all three velocity controllers.
| void libstp::drive::Drive::setVelocity | ( | const foundation::ChassisVelocity & | v_body | ) |
Set the desired body-frame velocity for the next control update.
| void libstp::drive::Drive::setVelocityControlConfig | ( | const ChassisVelocityControlConfig & | config | ) |
Replace the per-axis velocity-control settings and rebuild the controllers.
| void libstp::drive::Drive::softStop | ( | ) |
Request a controlled stop by zeroing the desired velocity.
| kinematics::MotorCommands libstp::drive::Drive::update | ( | double | dt | ) |
Run one chassis velocity control step and send the corrected command to kinematics.
|
nodiscard |
Forward the modeled wheel count from the underlying kinematics.