Files
ODrive/Firmware/MotorControl/open_loop_controller.hpp
Samuel Sadok a6587f8d8a fix various issues
- overcurrent error during motor calibration (this is caused by
overshoot. For now we just ignore the current limit during motor
calibration as we did before)
- factor 2 error at encoder calibration
- set error flag if Motor::arm() is called while the brake resistor is
enabled but disarmed.
- only arm brake resistor if enabled
- auto-arm brake resistor on clear_errors()
2020-11-13 18:45:49 +01:00

32 lines
890 B
C++

#ifndef __OPEN_LOOP_CONTROLLER_HPP
#define __OPEN_LOOP_CONTROLLER_HPP
#include "component.hpp"
#include <cmath>
#include <autogen/interfaces.hpp>
class OpenLoopController : public ComponentBase {
public:
void update(uint32_t timestamp) final;
// Config
float max_current_ramp_ = INFINITY; // [A/s]
float max_voltage_ramp_ = INFINITY; // [V/s]
float max_phase_vel_ramp_ = INFINITY; // [rad/s^2]
// Inputs
float target_vel_ = 0.0f;
float target_current_ = 0.0f;
float target_voltage_ = 0.0f;
float initial_phase_ = 0.0f;
// State/Outputs
uint32_t timestamp_ = 0;
OutputPort<float2D> Idq_setpoint_ = {{0.0f, 0.0f}};
OutputPort<float2D> Vdq_setpoint_ = {{0.0f, 0.0f}};
OutputPort<float> phase_ = 0.0f;
OutputPort<float> phase_vel_ = 0.0f;
OutputPort<float> total_distance_ = 0.0f;
};
#endif // __OPEN_LOOP_CONTROLLER_HPP