diff --git a/designs/cad/impeller_only_v3_larger.FCStd b/designs/cad/impeller_only_v3_larger.FCStd new file mode 100644 index 0000000..7056c97 Binary files /dev/null and b/designs/cad/impeller_only_v3_larger.FCStd differ diff --git a/src/B_G431B_ESC1_motor_controller/B_G431B_ESC1_motor_controller.ino b/src/B_G431B_ESC1_motor_controller/B_G431B_ESC1_motor_controller.ino index 5b60934..afee101 100644 --- a/src/B_G431B_ESC1_motor_controller/B_G431B_ESC1_motor_controller.ino +++ b/src/B_G431B_ESC1_motor_controller/B_G431B_ESC1_motor_controller.ino @@ -42,7 +42,7 @@ void setup() { // enable more verbose output for debugging // comment out if not needed - SimpleFOCDebug::enable(&Serial); + //SimpleFOCDebug::enable(&Serial); // initialize encoder sensor hardware sensor.init(); @@ -83,9 +83,9 @@ void setup() { motor.PID_velocity.P = 0.01; motor.PID_velocity.I = 0.004; - driver.voltage_limit = 8; - motor.voltage_limit = 4; - //motor.current_limit = 2; + driver.voltage_limit = 10; + motor.voltage_limit = 5; + //motor.current_limit = 0.2; motor.PID_velocity.limit = motor.voltage_limit; @@ -94,13 +94,13 @@ void setup() { motor.PID_velocity.output_ramp = 10; // velocity low pass filtering time constant - //motor.LPF_velocity.Tf = 0.1; + motor.LPF_velocity.Tf = 0.01; // comment out if not needed - motor.useMonitoring(Serial); + //motor.useMonitoring(Serial); - motor.monitor_downsample = 10000; - //motor.motion_downsample = 4; + //motor.monitor_downsample = 100000; + motor.motion_downsample = 1; // initialize motor motor.init(); @@ -118,6 +118,7 @@ void setup() { } void loop() { + // main FOC algorithm function motor.loopFOC(); @@ -129,6 +130,7 @@ void loop() { // Motion control function motor.move(targetV); + if (abs(motor.target) < 20.0f && motor.enabled==1) motor.disable(); if (abs(motor.target) >= 20.0f && motor.enabled==0) @@ -136,10 +138,18 @@ void loop() { // function intended to be used with serial plotter to monitor motor variables // significantly slowing the execution down!!!! - motor.monitor(); + //motor.monitor(); // user communication + /* + static uint32_t lastSerialRead = 0; + if (lastSerialRead == 32) { + lastSerialRead = 0; + commandESP.run(); + commandComp.run(); + } + lastSerialRead += 1; + */ commandESP.run(); - commandComp.run(); - + //commandComp.run(); }