Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/DCMotor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ void DCMotor::move(float new_target) {
setPhaseVoltage(voltage.q, 0.0f, 0.0f);
};

void DCMotor::setOutput(float voltage_target) {
setPhaseVoltage(voltage_target, 0.0f, 0.0f);
}

void DCMotor::setPhaseVoltage(float Uq, float Ud, float angle_el) {
if (enabled==1)
Expand Down
2 changes: 2 additions & 0 deletions src/DCMotor.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class DCMotor : public FOCMotor {
*/
void move(float new_target = NOT_SET) override;

void setOutput(float voltage_target = NOT_SET) override; //directly set the voltage on the output - used for setting it to zero

/**
* @param Uq Voltage to set to the motor
* @param Ud ignored for DC motors
Expand Down
2 changes: 2 additions & 0 deletions src/common/base_classes/FOCMotor.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class FOCMotor
*/
virtual void move(float target = NOT_SET)=0;

virtual void setOutput(float target = NOT_SET) = 0;

/**
* Method using FOC to set Uq to the motor at the optimal angle
* Heart of the FOC algorithm
Expand Down