libstp
Robotics library for Botball
Loading...
Searching...
No Matches
motor_adapter.hpp
Go to the documentation of this file.
1#pragma once
2#include "hal/IMotor.hpp"
3
4namespace libstp::drive
5{
14 {
15 public:
18
27 void setVelocity(double w_ref, double dt, bool* out_saturated = nullptr);
28
30 [[nodiscard]] double getVelocity() const;
31
33 void brake();
34
42
45 [[nodiscard]] const hal::motor::IMotor& motor() const;
46
48 void updateEncoderVelocity(double dt);
49
50 private:
51 hal::motor::IMotor* motor_{nullptr};
52
53 mutable double w_meas_filt_{0.0};
54 long long pos_prev_{0};
55 bool pos_prev_init_{false};
56 };
57}
void resetEncoderTracking()
Reset encoder position tracking to prevent stale deltas.
void setVelocity(double w_ref, double dt, bool *out_saturated=nullptr)
hal::motor::IMotor & motor()
MotorAdapter(hal::motor::IMotor *motor)
void updateEncoderVelocity(double dt)
const hal::motor::IMotor & motor() const
Interface for motor abstraction.
Definition IMotor.hpp:17