Skip to content

Commit 87ea185

Browse files
Merge branch 'simplefoc:dev' into dev
2 parents c28ad9d + 3c3e9c8 commit 87ea185

File tree

54 files changed

+322
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+322
-112
lines changed

examples/hardware_specific_examples/B_G431B_ESC1/B_G431B_ESC1.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ void doTarget(char* cmd) { command.motion(&motor, cmd); }
2626

2727
void setup() {
2828

29+
// use monitoring with serial
30+
Serial.begin(115200);
31+
// enable more verbose output for debugging
32+
// comment out if not needed
33+
SimpleFOCDebug::enable(&Serial);
34+
2935
// initialize encoder sensor hardware
3036
encoder.init();
3137
encoder.enableInterrupts(doA, doB);
@@ -76,9 +82,6 @@ void setup() {
7682
// maximal velocity of the position control
7783
motor.velocity_limit = 4;
7884

79-
80-
// use monitoring with serial
81-
Serial.begin(115200);
8285
// comment out if not needed
8386
motor.useMonitoring(Serial);
8487

examples/hardware_specific_examples/Bluepill_examples/encoder/bluepill_position_control/bluepill_position_control.ino

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
3333

3434
void setup() {
3535

36+
// use monitoring with serial
37+
Serial.begin(115200);
38+
// enable more verbose output for debugging
39+
// comment out if not needed
40+
SimpleFOCDebug::enable(&Serial);
41+
3642
// initialize encoder sensor hardware
3743
encoder.init();
3844
encoder.enableInterrupts(doA, doB, doI);
@@ -75,8 +81,6 @@ void setup() {
7581
motor.velocity_limit = 4;
7682

7783

78-
// use monitoring with serial
79-
Serial.begin(115200);
8084
// comment out if not needed
8185
motor.useMonitoring(Serial);
8286

examples/hardware_specific_examples/Bluepill_examples/magnetic_sensor/bluepill_position_control/bluepill_position_control.ino

+6-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
3636

3737
void setup() {
3838

39+
// use monitoring with serial
40+
Serial.begin(115200);
41+
// enable more verbose output for debugging
42+
// comment out if not needed
43+
SimpleFOCDebug::enable(&Serial);
44+
3945
// initialise magnetic sensor hardware
4046
sensor.init();
4147
// link the motor to the sensor
@@ -72,8 +78,6 @@ void setup() {
7278
// maximal velocity of the position control
7379
motor.velocity_limit = 40;
7480

75-
// use monitoring with serial
76-
Serial.begin(115200);
7781
// comment out if not needed
7882
motor.useMonitoring(Serial);
7983

examples/hardware_specific_examples/DRV8302_driver/3pwm_example/encoder/full_control_serial/full_control_serial.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
4343

4444
void setup() {
4545

46+
// use monitoring with serial
47+
Serial.begin(115200);
48+
// enable more verbose output for debugging
49+
// comment out if not needed
50+
SimpleFOCDebug::enable(&Serial);
51+
4652
// initialize encoder sensor hardware
4753
encoder.init();
4854
encoder.enableInterrupts(doA, doB);
@@ -90,9 +96,6 @@ void setup() {
9096
// angle loop velocity limit
9197
motor.velocity_limit = 50;
9298

93-
// use monitoring with serial for motor init
94-
// monitoring port
95-
Serial.begin(115200);
9699
// comment out if not needed
97100
motor.useMonitoring(Serial);
98101

examples/hardware_specific_examples/DRV8302_driver/6pwm_example/encoder/full_control_serial/full_control_serial.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
4646

4747
void setup() {
4848

49+
// use monitoring with serial
50+
Serial.begin(115200);
51+
// enable more verbose output for debugging
52+
// comment out if not needed
53+
SimpleFOCDebug::enable(&Serial);
54+
4955
// initialize encoder sensor hardware
5056
encoder.init();
5157
encoder.enableInterrupts(doA, doB);
@@ -91,9 +97,6 @@ void setup() {
9197
// angle loop velocity limit
9298
motor.velocity_limit = 50;
9399

94-
// use monitoring with serial for motor init
95-
// monitoring port
96-
Serial.begin(115200);
97100
// comment out if not needed
98101
motor.useMonitoring(Serial);
99102

examples/hardware_specific_examples/DRV8302_driver/esp32_current_control_low_side/esp32_current_control_low_side.ino

+6-4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
5151

5252
void setup() {
5353

54+
// use monitoring with serial
55+
Serial.begin(115200);
56+
// enable more verbose output for debugging
57+
// comment out if not needed
58+
SimpleFOCDebug::enable(&Serial);
59+
5460
// initialize encoder sensor hardware
5561
encoder.init();
5662
encoder.enableInterrupts(doA, doB);
@@ -115,10 +121,6 @@ void setup() {
115121
motor.voltage_limit = 12.0; // 12 Volt limit
116122
motor.current_limit = 2.0; // 2 Amp current limit
117123

118-
119-
// use monitoring with serial for motor init
120-
// monitoring port
121-
Serial.begin(115200);
122124
// comment out if not needed
123125
motor.useMonitoring(Serial);
124126
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D; // monitor the two currents d and q

examples/hardware_specific_examples/DRV8302_driver/stm32_current_control_low_side/stm32_current_control_low_side.ino

+6-4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
5151

5252
void setup() {
5353

54+
// use monitoring with serial
55+
Serial.begin(115200);
56+
// enable more verbose output for debugging
57+
// comment out if not needed
58+
SimpleFOCDebug::enable(&Serial);
59+
5460
// initialize encoder sensor hardware
5561
encoder.init();
5662
encoder.enableInterrupts(doA, doB);
@@ -115,10 +121,6 @@ void setup() {
115121
motor.voltage_limit = 12.0; // 12 Volt limit
116122
motor.current_limit = 2.0; // 2 Amp current limit
117123

118-
119-
// use monitoring with serial for motor init
120-
// monitoring port
121-
Serial.begin(115200);
122124
// comment out if not needed
123125
motor.useMonitoring(Serial);
124126
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D; // monitor the two currents d and q

examples/hardware_specific_examples/DRV8302_driver/teensy4_current_control_low_side/teensy4_current_control_low_side.ino

+6-4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
5454

5555
void setup() {
5656

57+
// use monitoring with serial
58+
Serial.begin(115200);
59+
// enable more verbose output for debugging
60+
// comment out if not needed
61+
SimpleFOCDebug::enable(&Serial);
62+
5763
// initialize encoder sensor hardware
5864
encoder.init();
5965
encoder.enableInterrupts(doA, doB);
@@ -116,10 +122,6 @@ void setup() {
116122
motor.voltage_limit = 12.0; // 12 Volt limit
117123
motor.current_limit = 2.0; // 2 Amp current limit
118124

119-
120-
// use monitoring with serial for motor init
121-
// monitoring port
122-
Serial.begin(115200);
123125
// comment out if not needed
124126
motor.useMonitoring(Serial);
125127
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D; // monitor the two currents d and q

examples/hardware_specific_examples/ESP32/encoder/esp32_position_control/esp32_position_control.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
2424

2525
void setup() {
2626

27+
// use monitoring with serial
28+
Serial.begin(115200);
29+
// enable more verbose output for debugging
30+
// comment out if not needed
31+
SimpleFOCDebug::enable(&Serial);
32+
2733
// initialize encoder sensor hardware
2834
encoder.init();
2935
encoder.enableInterrupts(doA, doB);
@@ -66,9 +72,6 @@ void setup() {
6672
// maximal velocity of the position control
6773
motor.velocity_limit = 4;
6874

69-
70-
// use monitoring with serial
71-
Serial.begin(115200);
7275
// comment out if not needed
7376
motor.useMonitoring(Serial);
7477

examples/hardware_specific_examples/ESP32/magnetic_sensor/esp32_position_control/esp32_position_control.ino

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
3333

3434
void setup() {
3535

36+
// use monitoring with serial
37+
Serial.begin(115200);
38+
// enable more verbose output for debugging
39+
// comment out if not needed
40+
SimpleFOCDebug::enable(&Serial);
41+
3642
// initialise magnetic sensor hardware
3743
sensor.init();
3844
// link the motor to the sensor
@@ -69,8 +75,6 @@ void setup() {
6975
// maximal velocity of the position control
7076
motor.velocity_limit = 40;
7177

72-
// use monitoring with serial
73-
Serial.begin(115200);
7478
// comment out if not needed
7579
motor.useMonitoring(Serial);
7680

examples/hardware_specific_examples/HMBGC_example/position_control/position_control.ino

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
4242

4343
void setup() {
4444

45+
// use monitoring with serial
46+
Serial.begin(115200);
47+
4548
// initialise encoder hardware
4649
encoder.init();
4750
// interrupt initialization
@@ -85,9 +88,6 @@ void setup() {
8588
// maximal velocity of the position control
8689
motor.velocity_limit = 4;
8790

88-
89-
// use monitoring with serial
90-
Serial.begin(115200);
9191
// comment out if not needed
9292
motor.useMonitoring(Serial);
9393

examples/hardware_specific_examples/Odrive_examples/odrive_example_encoder/odrive_example_encoder.ino

+6-2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ void doI(){encoder.handleIndex();}
7070

7171
void setup(){
7272

73+
// use monitoring with serial
74+
Serial.begin(115200);
75+
// enable more verbose output for debugging
76+
// comment out if not needed
77+
SimpleFOCDebug::enable(&Serial);
78+
7379
// pwm frequency to be used [Hz]
7480
driver.pwm_frequency = 20000;
7581
// power supply voltage [V]
@@ -96,8 +102,6 @@ void setup(){
96102
// alignment voltage limit
97103
motor.voltage_sensor_align = 0.5;
98104

99-
100-
Serial.begin(115200);
101105
// comment out if not needed
102106
motor.useMonitoring(Serial);
103107
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D;

examples/hardware_specific_examples/Odrive_examples/odrive_example_spi/odrive_example_spi.ino

+6-2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ SPIClass SPI_3(SPI3_MOSO, SPI3_MISO, SPI3_SCL);
6969

7070
void setup(){
7171

72+
// use monitoring with serial
73+
Serial.begin(115200);
74+
// enable more verbose output for debugging
75+
// comment out if not needed
76+
SimpleFOCDebug::enable(&Serial);
77+
7278
// pwm frequency to be used [Hz]
7379
driver.pwm_frequency = 20000;
7480
// power supply voltage [V]
@@ -94,8 +100,6 @@ void setup(){
94100
// alignment voltage limit
95101
motor.voltage_sensor_align = 0.5;
96102

97-
98-
Serial.begin(115200);
99103
// comment out if not needed
100104
motor.useMonitoring(Serial);
101105
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D;

examples/hardware_specific_examples/SAMD_examples/nano33IoT/nano33IoT_velocity_control/nano33IoT_velocity_control.ino

+5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }
2323

2424

2525
void setup() {
26+
// use monitoring with serial
2627
Serial.begin(115200);
28+
// enable more verbose output for debugging
29+
// comment out if not needed
30+
SimpleFOCDebug::enable(&Serial);
31+
2732
delay(1000);
2833
Serial.println("Initializing...");
2934

examples/hardware_specific_examples/SimpleFOC-PowerShield/version_v02/single_full_control_example/single_full_control_example.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ void doTarget(char* cmd){ command.scalar(&motor.target, cmd); }
2121

2222
void setup() {
2323

24+
// use monitoring with serial
25+
Serial.begin(115200);
26+
// enable more verbose output for debugging
27+
// comment out if not needed
28+
SimpleFOCDebug::enable(&Serial);
29+
2430
// initialize encoder sensor hardware
2531
encoder.init();
2632
encoder.enableInterrupts(doA, doB);
@@ -56,9 +62,6 @@ void setup() {
5662
// angle loop velocity limit
5763
motor.velocity_limit = 20;
5864

59-
// use monitoring with serial for motor init
60-
// monitoring port
61-
Serial.begin(115200);
6265
// comment out if not needed
6366
motor.useMonitoring(Serial);
6467
motor.monitor_downsample = 0; // disable intially

examples/hardware_specific_examples/SimpleFOCMini/angle_control/angle_control.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ Commander command = Commander(Serial);
3838
void doMotor(char* cmd) { command.motor(&motor, cmd); }
3939

4040
void setup() {
41+
// use monitoring with serial
42+
Serial.begin(115200);
43+
// enable more verbose output for debugging
44+
// comment out if not needed
45+
SimpleFOCDebug::enable(&Serial);
46+
4147
// if SimpleFOCMini is stacked in arduino headers
4248
// on pins 12,11,10,9,8
4349
// pin 12 is used as ground
@@ -84,9 +90,6 @@ void setup() {
8490
// maximal velocity of the position control
8591
motor.velocity_limit = 4;
8692

87-
88-
// use monitoring with serial
89-
Serial.begin(115200);
9093
// comment out if not needed
9194
motor.useMonitoring(Serial);
9295

examples/hardware_specific_examples/SimpleFOCShield/version_v1/double_full_control_example/double_full_control_example.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ void doMotor2(char* cmd){ command.motor(&motor2, cmd); }
2828

2929
void setup() {
3030

31+
// use monitoring with serial
32+
Serial.begin(115200);
33+
// enable more verbose output for debugging
34+
// comment out if not needed
35+
SimpleFOCDebug::enable(&Serial);
36+
3137
// initialize encoder sensor hardware
3238
encoder1.init();
3339
encoder1.enableInterrupts(doA1, doB1);
@@ -72,9 +78,6 @@ void setup() {
7278
motor1.velocity_limit = 20;
7379
motor2.velocity_limit = 20;
7480

75-
// use monitoring with serial for motor init
76-
// monitoring port
77-
Serial.begin(115200);
7881
// comment out if not needed
7982
motor1.useMonitoring(Serial);
8083
motor2.useMonitoring(Serial);

examples/hardware_specific_examples/SimpleFOCShield/version_v1/single_full_control_example/single_full_control_example.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ void doMotor(char* cmd){ command.motor(&motor, cmd); }
1717

1818
void setup() {
1919

20+
// use monitoring with serial
21+
Serial.begin(115200);
22+
// enable more verbose output for debugging
23+
// comment out if not needed
24+
SimpleFOCDebug::enable(&Serial);
25+
2026
// initialize encoder sensor hardware
2127
encoder.init();
2228
encoder.enableInterrupts(doA, doB);
@@ -48,9 +54,6 @@ void setup() {
4854
// angle loop velocity limit
4955
motor.velocity_limit = 20;
5056

51-
// use monitoring with serial for motor init
52-
// monitoring port
53-
Serial.begin(115200);
5457
// comment out if not needed
5558
motor.useMonitoring(Serial);
5659
motor.monitor_downsample = 0; // disable intially

0 commit comments

Comments
 (0)