Skip to content

Commit 10759a0

Browse files
committed
Tested steppers, added support for phase resitance
1 parent 1322f3e commit 10759a0

File tree

17 files changed

+188
-179
lines changed

17 files changed

+188
-179
lines changed

.github/workflows/ccpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ jobs:
1111
uses: ArminJo/arduino-test-compile@v1.0.0
1212
with:
1313
libraries: PciManager
14-
examples-exclude: bluepill_position_control, esp32_position_control, esp32_i2c_dual_bus_example, stm32_i2c_dual_bus_example, magnetic_sensor_spi_alt_example, simplefoc_osc_esp32_3pwm
14+
examples-exclude: bluepill_position_control, esp32_position_control, esp32_i2c_dual_bus_example, stm32_i2c_dual_bus_example, magnetic_sensor_spi_alt_example, osc_esp32_3pwm, osc_esp32_fullcontrol

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Therefore this is an attempt to:
5353
> - `ControlType::voltage` does not exist any more now - `MotionControlType::torque`
5454
5555

56-
## Arduino *SimpleFOCShield* v2.0.2
56+
## Arduino *SimpleFOCShield* v2.0.3
5757

5858
<p align="">
5959
<a href="https://youtu.be/G5pbo0C6ujE">
@@ -80,7 +80,7 @@ Therefore this is an attempt to:
8080
<p align=""><img src="https://simplefoc.com/assets/img/v2.jpg" height="180px"> <img src="https://simplefoc.com/assets/img/v1.jpg" height="180px"> <img src="https://docs.simplefoc.com/extras/Images/simple_foc_shield_v13_small.gif" height="180x"></p>
8181

8282

83-
## Arduino *SimpleFOClibrary* v2.0.2
83+
## Arduino *SimpleFOClibrary* v2.1
8484

8585
<p align="">
8686
<a href="https://youtu.be/Y5kLeqTc6Zk">

examples/hardware_specific_examples/SimpleFOCShield/version_v2/single_full_control_example/single_full_control_example.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void setup() {
7272
// subscribe motor to the commander
7373
command.add('M', doMotor, "motor");
7474

75-
// Run user commands to configure and the motor (find the full command list in docs.simplefoc.com)
75+
// Run user commands to configure and the motor (find the full command list in docs.simplefoc.com)
7676
Serial.println(F("Motor commands sketch | Initial motion control > torque/voltage : target 2V."));
7777

7878
_delay(1000);

examples/motor_commands_serial_examples/encoder/full_control_serial/full_control_serial.ino

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,7 @@
88
* - set target values
99
* - check all the configuration values
1010
*
11-
* To check the config value just enter the command letter.
12-
* For example: - to read velocity PI controller P gain run: P
13-
* - to set velocity PI controller P gain to 1.2 run: P1.2
14-
*
15-
* To change the target value just enter a number in the terminal:
16-
* For example: - to change the target value to -0.1453 enter: -0.1453
17-
* - to get the current target value enter: V3
18-
*
19-
* List of commands:
20-
* - P: velocity PID controller P gain
21-
* - I: velocity PID controller I gain
22-
* - D: velocity PID controller D gain
23-
* - R: velocity PID controller voltage ramp
24-
* - F: velocity Low pass filter time constant
25-
* - K: angle P controller P gain
26-
* - N: angle P controller velocity limit
27-
* - L: system voltage limit
28-
* - C: control loop
29-
* - 0: voltage
30-
* - 1: velocity
31-
* - 2: angle
32-
* - V: get motor variables
33-
* - 0: currently set voltage
34-
* - 1: current velocity
35-
* - 2: current angle
36-
* - 3: current target value
37-
*
11+
* See more info in docs.simplefoc.com/commander_interface
3812
*/
3913
#include <SimpleFOC.h>
4014

examples/motor_commands_serial_examples/hall_sensor/full_control_serial/full_control_serial.ino

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,7 @@
88
* - set target values
99
* - check all the configuration values
1010
*
11-
* To check the config value just enter the command letter.
12-
* For example: - to read velocity PI controller P gain run: P
13-
* - to set velocity PI controller P gain to 1.2 run: P1.2
14-
*
15-
* To change the target value just enter a number in the terminal:
16-
* For example: - to change the target value to -0.1453 enter: -0.1453
17-
* - to get the current target value enter: V3
18-
*
19-
* List of commands:
20-
* - P: velocity PID controller P gain
21-
* - I: velocity PID controller I gain
22-
* - D: velocity PID controller D gain
23-
* - R: velocity PID controller voltage ramp
24-
* - F: velocity Low pass filter time constant
25-
* - K: angle P controller P gain
26-
* - N: angle P controller velocity limit
27-
* - L: system voltage limit
28-
* - C: control loop
29-
* - 0: voltage
30-
* - 1: velocity
31-
* - 2: angle
32-
* - V: get motor variables
33-
* - 0: currently set voltage
34-
* - 1: current velocity
35-
* - 2: current angle
36-
* - 3: current target value
37-
*
11+
* See more info in docs.simplefoc.com/commander_interface
3812
*/
3913
#include <SimpleFOC.h>
4014
// software interrupt library

examples/motor_commands_serial_examples/magnetic_sensor/full_control_serial/full_control_serial.ino

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,7 @@
88
* - set target values
99
* - check all the configuration values
1010
*
11-
* To check the config value just enter the command letter.
12-
* For example: - to read velocity PI controller P gain run: P
13-
* - to set velocity PI controller P gain to 1.2 run: P1.2
14-
*
15-
* To change the target value just enter a number in the terminal:
16-
* For example: - to change the target value to -0.1453 enter: -0.1453
17-
* - to get the current target value enter: V3
18-
*
19-
* List of commands:
20-
* - P: velocity PID controller P gain
21-
* - I: velocity PID controller I gain
22-
* - D: velocity PID controller D gain
23-
* - R: velocity PID controller voltage ramp
24-
* - F: velocity Low pass filter time constant
25-
* - K: angle P controller P gain
26-
* - N: angle P controller velocity limit
27-
* - L: system voltage limit
28-
* - C: control loop
29-
* - 0: voltage
30-
* - 1: velocity
31-
* - 2: angle
32-
* - V: get motor variables
33-
* - 0: currently set voltage
34-
* - 1: current velocity
35-
* - 2: current angle
36-
* - 3: current target value
37-
*
11+
* See more info in docs.simplefoc.com/commander_interface
3812
*/
3913
#include <SimpleFOC.h>
4014

src/BLDCMotor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "BLDCMotor.h"
22

3-
// BLDCMotor( int pp)
3+
// BLDCMotor( int pp , float R)
44
// - pp - pole pair number
55
// - R - motor phase resistance
66
BLDCMotor::BLDCMotor(int pp, float _R)
@@ -306,7 +306,7 @@ void BLDCMotor::move(float new_target) {
306306
switch (controller) {
307307
case MotionControlType::torque:
308308
if(torque_controller == TorqueControlType::voltage) // if voltage torque control
309-
if(!_isset(phase_resistance)) voltage.q = current_sp;
309+
if(!_isset(phase_resistance)) voltage.q = target;
310310
else voltage.q = target*phase_resistance;
311311
else
312312
current_sp = target; // if current/foc_current torque control

0 commit comments

Comments
 (0)