Skip to content

Commit 3c7290b

Browse files
committed
public setPhaseVoltage
1 parent 05b7f8e commit 3c7290b

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

src/BLDCMotor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class BLDCMotor: public FOCMotor
7878
* @param Ud Current voltage in d axis to set to the motor
7979
* @param angle_el current electrical angle of the motor
8080
*/
81-
void setPhaseVoltage(float Uq, float Ud, float angle_el);
81+
void setPhaseVoltage(float Uq, float Ud, float angle_el) override;
8282

8383
private:
8484
// FOC methods

src/StepperMotor.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,18 @@ class StepperMotor: public FOCMotor
7878

7979
float Ualpha,Ubeta; //!< Phase voltages U alpha and U beta used for inverse Park and Clarke transform
8080

81-
private:
82-
83-
// FOC methods
84-
/**
81+
/**
8582
* Method using FOC to set Uq to the motor at the optimal angle
8683
* Heart of the FOC algorithm
8784
*
8885
* @param Uq Current voltage in q axis to set to the motor
8986
* @param Ud Current voltage in d axis to set to the motor
9087
* @param angle_el current electrical angle of the motor
9188
*/
92-
void setPhaseVoltage(float Uq, float Ud , float angle_el);
89+
void setPhaseVoltage(float Uq, float Ud, float angle_el) override;
9390

91+
private:
92+
9493
/** Sensor alignment to electrical 0 angle of the motor */
9594
int alignSensor();
9695
/** Motor and sensor alignment to the sensors absolute 0 angle */

src/common/base_classes/FOCMotor.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,16 @@ class FOCMotor
127127
*/
128128
virtual void move(float target = NOT_SET)=0;
129129

130+
/**
131+
* Method using FOC to set Uq to the motor at the optimal angle
132+
* Heart of the FOC algorithm
133+
*
134+
* @param Uq Current voltage in q axis to set to the motor
135+
* @param Ud Current voltage in d axis to set to the motor
136+
* @param angle_el current electrical angle of the motor
137+
*/
138+
virtual void setPhaseVoltage(float Uq, float Ud, float angle_el)=0;
139+
130140
// State calculation methods
131141
/** Shaft angle calculation in radians [rad] */
132142
float shaftAngle();
@@ -137,6 +147,7 @@ class FOCMotor
137147
float shaftVelocity();
138148

139149

150+
140151
/**
141152
* Electrical angle calculation
142153
*/

0 commit comments

Comments
 (0)