Skip to content

Commit 9982c47

Browse files
committed
FEAT refactured examples to support PID controller
1 parent 674d1a4 commit 9982c47

File tree

16 files changed

+63
-50
lines changed

16 files changed

+63
-50
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ void setup() {
4242
// default parameters in defaults.h
4343

4444
// velocity PI controller parameters
45-
motor.PI_velocity.P = 0.2;
46-
motor.PI_velocity.I = 20;
45+
motor.PID_velocity.P = 0.2;
46+
motor.PID_velocity.I = 20;
4747
// default voltage_power_supply
4848
motor.voltage_limit = 6;
4949
// jerk control using voltage voltage ramp
5050
// default value is 300 volts per sec ~ 0.3V per millisecond
51-
motor.PI_velocity.voltage_ramp = 1000;
51+
motor.PID_velocity.output_ramp = 1000;
5252

5353
// velocity low pass filtering time constant
5454
motor.LPF_velocity.Tf = 0.01;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ void setup() {
4343
// default parameters in defaults.h
4444

4545
// velocity PI controller parameters
46-
motor.PI_velocity.P = 0.2;
47-
motor.PI_velocity.I = 20;
46+
motor.PID_velocity.P = 0.2;
47+
motor.PID_velocity.I = 20;
4848
// maximal voltage to be set to the motor
4949
motor.voltage_limit = 6;
5050

examples/hardware_specific_examples/DRV8305_driver/motor_full_control_serial_examples/encoder/full_control_serial/full_control_serial.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ void setup() {
6464
motor.controller = ControlType::voltage;
6565

6666
// contoller configuration based on the controll type
67-
motor.PI_velocity.P = 0.2;
68-
motor.PI_velocity.I = 20;
67+
motor.PID_velocity.P = 0.2;
68+
motor.PID_velocity.I = 20;
6969
// default voltage_power_supply
7070
motor.voltage_limit = 12;
7171

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ void setup() {
3838
// default parameters in defaults.h
3939

4040
// velocity PI controller parameters
41-
motor.PI_velocity.P = 0.2;
42-
motor.PI_velocity.I = 20;
41+
motor.PID_velocity.P = 0.2;
42+
motor.PID_velocity.I = 20;
4343
// default voltage_power_supply
4444
motor.voltage_limit = 6;
4545
// jerk control using voltage voltage ramp
4646
// default value is 300 volts per sec ~ 0.3V per millisecond
47-
motor.PI_velocity.voltage_ramp = 1000;
47+
motor.PID_velocity.output_ramp = 1000;
4848

4949
// velocity low pass filtering time constant
5050
motor.LPF_velocity.Tf = 0.01;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ void setup() {
4242
// default parameters in defaults.h
4343

4444
// velocity PI controller parameters
45-
motor.PI_velocity.P = 0.2;
46-
motor.PI_velocity.I = 20;
45+
motor.PID_velocity.P = 0.2;
46+
motor.PID_velocity.I = 20;
4747
// maximal voltage to be set to the motor
4848
motor.voltage_limit = 6;
4949

examples/hardware_specific_examples/HMBGC_example/position_control/position_control.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ void setup() {
5656
// default parameters in defaults.h
5757

5858
// velocity PI controller parameters
59-
motor.PI_velocity.P = 0.2;
60-
motor.PI_velocity.I = 20;
59+
motor.PID_velocity.P = 0.2;
60+
motor.PID_velocity.I = 20;
6161
// default voltage_power_supply
6262
motor.voltage_limit = 6;
6363
// jerk control using voltage voltage ramp
6464
// default value is 300 volts per sec ~ 0.3V per millisecond
65-
motor.PI_velocity.voltage_ramp = 1000;
65+
motor.PID_velocity.output_ramp = 1000;
6666

6767
// velocity low pass filtering time constant
6868
motor.LPF_velocity.Tf = 0.01;

examples/motion_control/position_motion_control/encoder/angle_control/angle_control.ino

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ void setup() {
6767
// default parameters in defaults.h
6868

6969
// velocity PI controller parameters
70-
motor.PI_velocity.P = 0.2;
71-
motor.PI_velocity.I = 20;
70+
motor.PID_velocity.P = 0.2;
71+
motor.PID_velocity.I = 20;
72+
motor.PID_velocity.D = 0;
7273
// default voltage_power_supply
7374
motor.voltage_limit = 6;
7475
// jerk control using voltage voltage ramp
7576
// default value is 300 volts per sec ~ 0.3V per millisecond
76-
motor.PI_velocity.voltage_ramp = 1000;
77+
motor.PID_velocity.output_ramp = 1000;
7778

7879
// velocity low pass filtering time constant
7980
motor.LPF_velocity.Tf = 0.01;

examples/motion_control/position_motion_control/hall_sensor/angle_control/angle_control.ino

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,14 @@ void setup() {
6060
// default parameters in defaults.h
6161

6262
// velocity PI controller parameters
63-
motor.PI_velocity.P = 0.2;
64-
motor.PI_velocity.I = 2;
63+
motor.PID_velocity.P = 0.2;
64+
motor.PID_velocity.I = 2;
65+
motor.PID_velocity.D = 0;
6566
// default voltage_power_supply
6667
motor.voltage_limit = 6;
6768
// jerk control using voltage voltage ramp
6869
// default value is 300 volts per sec ~ 0.3V per millisecond
69-
motor.PI_velocity.voltage_ramp = 1000;
70+
motor.PID_velocity.output_ramp = 1000;
7071

7172
// velocity low pass filtering time constant
7273
motor.LPF_velocity.Tf = 0.01;

examples/motion_control/position_motion_control/magnetic_sensor/angle_control/angle_control.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ void setup() {
4040
// default parameters in defaults.h
4141

4242
// velocity PI controller parameters
43-
motor.PI_velocity.P = 0.2;
44-
motor.PI_velocity.I = 20;
43+
motor.PID_velocity.P = 0.2;
44+
motor.PID_velocity.I = 20;
45+
motor.PID_velocity.D = 0;
4546
// maximal voltage to be set to the motor
4647
motor.voltage_limit = 6;
4748

examples/motion_control/velocity_motion_control/encoder/velocity_control/velocity_control.ino

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,14 @@ void setup() {
6868
// default parameters in defaults.h
6969

7070
// velocity PI controller parameters
71-
motor.PI_velocity.P = 0.2;
72-
motor.PI_velocity.I = 20;
71+
motor.PID_velocity.P = 0.2;
72+
motor.PID_velocity.I = 20;
73+
motor.PID_velocity.D = 0;
7374
// default voltage_power_supply
7475
motor.voltage_limit = 6;
7576
// jerk control using voltage voltage ramp
7677
// default value is 300 volts per sec ~ 0.3V per millisecond
77-
motor.PI_velocity.voltage_ramp = 1000;
78+
motor.PID_velocity.output_ramp = 1000;
7879

7980
// velocity low pass filtering time constant
8081
motor.LPF_velocity.Tf = 0.01;

0 commit comments

Comments
 (0)