You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/common/base_classes/FOCMotor.h
+17-2Lines changed: 17 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -160,10 +160,20 @@ class FOCMotor
160
160
/**
161
161
* Function linking a motor and a sensor
162
162
*
163
-
* @param sensor Sensor class wrapper for the FOC algorihtm to read the motor angle and velocity
163
+
* @param sensor Sensor class wrapper for the FOC algorithm to read the motor angle and velocity
164
164
*/
165
165
voidlinkSensor(Sensor* sensor);
166
166
167
+
168
+
169
+
/**
170
+
* Function linking a motor and a second sensor used only for position control
171
+
* If not provided, the motor will use the sensor linked with the linkSensor function for position control as well
172
+
*
173
+
* @param sensor Sensor class wrapper for the FOC algorithm to read the motor angle and velocity
174
+
*/
175
+
voidlinkPositionLoopSensor(Sensor* sensor, Direction direction = Direction::CW);
176
+
167
177
/**
168
178
* Function linking a motor and current sensing
169
179
*
@@ -265,12 +275,15 @@ class FOCMotor
265
275
unsignedint motion_downsample = DEF_MOTION_DOWNSMAPLE; //!< parameter defining the ratio of downsampling for move commad
266
276
unsignedint motion_cnt = 0; //!< counting variable for downsampling for move commad
267
277
268
-
// sensor related variabels
278
+
// sensor related variables
269
279
float sensor_offset; //!< user defined sensor zero offset
280
+
float position_loop_sensor_direction = Direction::UNKNOWN; //!< direction of the position loop sensor compared to the sensor linked with linkSensor function - default is 1, if set to -1 the direction will be flipped
270
281
float zero_electric_angle = NOT_SET;//!< absolute zero electric angle - if available
271
282
Direction sensor_direction = Direction::UNKNOWN; //!< default is CW. if sensor_direction == Direction::CCW then direction will be flipped compared to CW. Set to UNKNOWN to set by calibration
272
283
bool pp_check_result = false; //!< the result of the PP check, if run during loopFOC
273
284
285
+
286
+
274
287
/**
275
288
* Function providing BLDCMotor class with the
276
289
* Serial interface and enabling monitoring mode
@@ -299,6 +312,8 @@ class FOCMotor
299
312
* - HallSensor
300
313
*/
301
314
Sensor* sensor;
315
+
Sensor* position_loop_sensor; //!< optional second sensor used only for position control - if not provided the sensor linked with linkSensor will be used for position control as well
0 commit comments