Skip to content

Commit 1425dff

Browse files
authored
Merge pull request #326 from Candas1/flux_observer_sensor
Move Ualpha and Ubeta to FOCMotor
2 parents 977b141 + 1cd3479 commit 1425dff

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

src/BLDCMotor.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ class BLDCMotor: public FOCMotor
6969
void move(float target = NOT_SET) override;
7070

7171
float Ua, Ub, Uc;//!< Current phase voltages Ua,Ub and Uc set to motor
72-
float Ualpha, Ubeta; //!< Phase voltages U alpha and U beta used for inverse Park and Clarke transform
73-
72+
7473
/**
7574
* Method using FOC to set Uq to the motor at the optimal angle
7675
* Heart of the FOC algorithm

src/StepperMotor.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ class StepperMotor: public FOCMotor
7373
*/
7474
void move(float target = NOT_SET) override;
7575

76-
float Ualpha,Ubeta; //!< Phase voltages U alpha and U beta used for inverse Park and Clarke transform
77-
7876
/**
7977
* Method using FOC to set Uq to the motor at the optimal angle
8078
* Heart of the FOC algorithm

src/common/base_classes/FOCMotor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ FOCMotor::FOCMotor()
3232

3333
// voltage bemf
3434
voltage_bemf = 0;
35+
36+
// Initialize phase voltages U alpha and U beta used for inverse Park and Clarke transform
37+
Ualpha = 0;
38+
Ubeta = 0;
3539

3640
//monitor_port
3741
monitor_port = nullptr;

src/common/base_classes/FOCMotor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ class FOCMotor
161161
DQVoltage_s voltage;//!< current d and q voltage set to the motor
162162
DQCurrent_s current;//!< current d and q current measured
163163
float voltage_bemf; //!< estimated backemf voltage (if provided KV constant)
164+
float Ualpha, Ubeta; //!< Phase voltages U alpha and U beta used for inverse Park and Clarke transform
165+
164166

165167
// motor configuration parameters
166168
float voltage_sensor_align;//!< sensor and motor align voltage parameter

0 commit comments

Comments
 (0)