Skip to content

update #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 128 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
6b2e449
Merge branch 'master' into dev
maxlem-neuralium May 10, 2021
a71f12c
Samd support add support for serial insterface other than Serial
maxlem-neuralium May 10, 2021
d37f34e
initial low side added
askuric May 13, 2021
dd3dbeb
Merge branch 'FEAT_low_side_cs' into dev
askuric May 14, 2021
c21dc2e
LowSideCurrentSense: first (truly) successful DMA+ADC readings, 1.65-…
maxlem May 15, 2021
e6d77b0
wrapped samd21 adc/dma implementation in an ugly class
maxlem May 15, 2021
0b7839f
FEAT added weak definitions of generic hardware implementations + ard…
askuric May 15, 2021
9af38fa
SAMDCurrentSenseADCDMA class
maxlem May 15, 2021
7698c0e
FEAT ADC-DMA fix deadlock
maxlem May 18, 2021
a0d17a0
Samd support add support for serial insterface other than Serial
maxlem-neuralium May 10, 2021
db7d865
LowSideCurrentSense: first (truly) successful DMA+ADC readings, 1.65-…
maxlem May 15, 2021
7d3c011
wrapped samd21 adc/dma implementation in an ugly class
maxlem May 15, 2021
a5c7528
SAMDCurrentSenseADCDMA class
maxlem May 15, 2021
7e802f6
FEAT ADC-DMA fix deadlock
maxlem May 18, 2021
0d54abe
Merge branch 'dev' of github.com:maxlem/Arduino-FOC into dev
maxlem May 18, 2021
bb7d29c
FEAT add _startADC3PinConversionLowSide() API
maxlem May 18, 2021
e1f4292
Merge pull request #79 from maxlem/dev
runger1101001 May 18, 2021
dce9774
remove oddities in MagneticSensorSPI - fix issue #82
runger1101001 May 30, 2021
e3bd3ac
sensor precision fix, part 1
runger1101001 May 30, 2021
cb47fd0
mask out SAMD21 current sensing when compiling on other platforms
runger1101001 May 30, 2021
a767b31
Merge branch 'dev' into sensor_fixes
runger1101001 May 30, 2021
fef9782
sensor precision fix, part 2, sensor changes
runger1101001 May 30, 2021
f86d5c4
sensor precision fix - refactored API
runger1101001 May 30, 2021
83798ea
adapted motor code to new API, added comments for precision issues
runger1101001 May 30, 2021
a5df234
add full rotations to velocity calculations
runger1101001 May 30, 2021
9105744
Merge pull request #86 from runger1101001/dev
runger1101001 May 31, 2021
c642756
comments
runger1101001 May 31, 2021
efda8c5
Merge branch 'dev' into stm32_sensor_fix
runger1101001 May 31, 2021
a13a76e
Merge pull request #87 from runger1101001/stm32_sensor_fix
runger1101001 May 31, 2021
42ce551
Use float instead of double constants for improved speed
KaSroka May 31, 2021
709a558
add a (optional) init method to sensor base class
runger1101001 Jun 3, 2021
ce75219
FEAT esp32 adc wrapper
askuric Jun 5, 2021
a8acae3
merge of esp32 low side wrapper with current dev
askuric Jun 5, 2021
ae31910
added weak definitions for - esp32 redefine analogRead
askuric Jun 5, 2021
644389b
FEAT fix of esp32 driver + added support for per phase lpf for curren…
askuric Jun 5, 2021
48d38d3
FEAT merge with dev
askuric Jun 5, 2021
dc51797
FEAT fix merge bugs
askuric Jun 5, 2021
2bda51f
merge conflict hardware_api
askuric Jun 5, 2021
e3f394f
Merge branch 'KaSroka-use_float_consts' into dev
askuric Jun 5, 2021
1a6269d
preparation for 2.1.2
askuric Jun 5, 2021
7382429
FEAT due to the low memory of the Arduino UNO remove the per phase fi…
askuric Jun 5, 2021
b860f4d
pwm sensor allowed arduino uno attach interrupt
askuric Jun 6, 2021
d6b33f4
FIX set voltage d to 0 when in torque mode
askuric Jun 6, 2021
a22c2bc
API change stepperdriver2pwm
askuric Jun 6, 2021
98c10e6
avoid compiling samd examples
askuric Jun 6, 2021
c1201ed
Merge branch 'dev' into sensor_fixes
runger1101001 Jun 6, 2021
22d003c
performance optimisation - don't return angle on updateSensor()
runger1101001 Jun 6, 2021
9cf18c2
doh! TCC0 has 6 output channels - fixed WO_associations table
runger1101001 Jun 7, 2021
a1149e1
add enable_active_high setting to 3-PWM driver also
runger1101001 Jun 7, 2021
17dc7fb
comments updated
runger1101001 Jun 7, 2021
9114ecd
Merge branch 'dev' into sensor_fixes
runger1101001 Jun 7, 2021
a875e40
esp32 2 or 3 adc lines automatic
askuric Jun 10, 2021
0aa327d
Update ccpp.yml
askuric Jun 10, 2021
b966b5d
Update ccpp.yml
askuric Jun 10, 2021
9d8bd10
Update ccpp.yml
askuric Jun 10, 2021
265c4d1
Update ccpp.yml
askuric Jun 10, 2021
fecf077
Update ccpp.yml
askuric Jun 10, 2021
075925d
Update ccpp.yml
askuric Jun 10, 2021
695ba46
Update ccpp.yml
askuric Jun 10, 2021
1a43717
Update ccpp.yml
askuric Jun 10, 2021
221e48c
Update ccpp.yml
askuric Jun 10, 2021
0bb5256
Update ccpp.yml
askuric Jun 10, 2021
d157c86
Update ccpp.yml
askuric Jun 10, 2021
2ea35dd
FIX esp32 error
askuric Jun 10, 2021
eac2d14
Merge branch 'dev' of github.com:askuric/Arduino-FOC into dev
askuric Jun 10, 2021
07f842e
FIX bluepill examples
askuric Jun 10, 2021
0261684
Update ccpp.yml
askuric Jun 10, 2021
999d000
Update ccpp.yml
askuric Jun 10, 2021
5c4c075
FIX nano33 example
askuric Jun 10, 2021
e59f38c
Merge branch 'dev' of github.com:askuric/Arduino-FOC into dev
askuric Jun 10, 2021
954545b
Update ccpp.yml
askuric Jun 10, 2021
dde0ef3
Update ccpp.yml
askuric Jun 10, 2021
c89ae6b
Update ccpp.yml
askuric Jun 10, 2021
88d383b
FEAT added low-side esp32 BRV8302 example
askuric Jun 10, 2021
e33782a
Merge branch 'dev' of github.com:askuric/Arduino-FOC into dev
askuric Jun 10, 2021
6267e79
Update ccpp.yml
askuric Jun 10, 2021
5f64df6
Update ccpp.yml
askuric Jun 10, 2021
1533bf2
Merge branch 'sensor_fixes' of git://github.com/runger1101001/Arduino…
askuric Jun 16, 2021
1b11bd4
Prevent unintended float-to-double casts
sDessens Jul 1, 2021
edce7d4
some refactoring and bug fixng
askuric Jul 20, 2021
8b3046f
quick readme update
askuric Jul 20, 2021
d22d344
Merge branch 'dev' of github.com:askuric/Arduino-FOC into dev
askuric Jul 20, 2021
f204ca5
memory constraint arudino uno
askuric Jul 20, 2021
7ed3868
Arduino UNO memeory shrinking
askuric Jul 20, 2021
361d043
v3 memory optim for Arduino UNO
askuric Jul 20, 2021
886f571
Merge pull request #100 from sDessens/no_more_doubles
askuric Jul 20, 2021
3d9fee8
Rename hall_sensors_software_interrupt_example.ino to hall_sensors_so…
askuric Aug 3, 2021
b7266ff
Create atmega32u4_mcu.cpp
candyriver Aug 21, 2021
1d3e44c
Merge pull request #108 from candyriver/dev
askuric Aug 25, 2021
d226061
added support for leonardo #108 and some cases for stm32l0x achitecture
askuric Aug 25, 2021
9f689db
added initial support for portenta, intial support for esp8266 + leon…
askuric Aug 25, 2021
63366cd
separation esp32 + esp8266
askuric Aug 25, 2021
d518987
pwm frequency not set initially
askuric Aug 25, 2021
b040f7d
merge with dev
askuric Aug 25, 2021
9251630
remove default params from checkbus, encoder added empty update, bug …
askuric Aug 25, 2021
3a4ea20
update readme + library properties
askuric Aug 25, 2021
63d5632
forgotten pwm_frequency default
askuric Aug 25, 2021
a710729
forgotten define portenta
askuric Aug 25, 2021
8a86629
stm32 bugfix
askuric Aug 25, 2021
a55da2d
Implement current sense for STM32 based B-G431B-ESC1
sDessens Apr 28, 2021
c1ce9d7
add example for B-G431B-ESC1 current sense
sDessens Apr 28, 2021
48192e0
issue #102 : update exxmple esp32 and added the sample code for secon…
askuric Sep 16, 2021
6fc6d44
forgotten excludes
askuric Sep 16, 2021
dfb1b3c
issue #112
askuric Sep 16, 2021
87c520f
Merge pull request #73 from sDessens/B-G431B-ESC1-current-sense-rebase-2
askuric Sep 16, 2021
6053c1c
reqdme update after pr #73
askuric Sep 16, 2021
dfe4222
current sense filtering #102 in monitor
askuric Sep 16, 2021
a64162c
forgotten exclude B_G431B
askuric Sep 16, 2021
461ed57
shaft angle addded: forgotten the sensor direction
askuric Sep 16, 2021
f927db2
remove the initial glitch #111 and #110
askuric Sep 16, 2021
e6836b3
antiwindup update Foxboro type #59
askuric Sep 16, 2021
4fe57a8
typo in antiwindup #59
askuric Sep 16, 2021
71652eb
private vars
askuric Sep 16, 2021
ec2d96e
unset variables
askuric Sep 16, 2021
af78dac
esp32 compile error
askuric Sep 20, 2021
24441b1
duplicated guards resolve #115
askuric Sep 29, 2021
ed93e67
Merge branch 'dev' of github.com:askuric/Arduino-FOC into dev
askuric Sep 29, 2021
657d339
esp32 fix reboot error
askuric Sep 29, 2021
3d142b7
remove the anti-windup
askuric Oct 2, 2021
fbd00f0
readme update
askuric Oct 2, 2021
13a389d
fix merge errors
runger1101001 Oct 2, 2021
47429a2
Merge branch 'dev' of https://github.com/simplefoc/Arduino-FOC.git in…
runger1101001 Oct 2, 2021
673e509
Merge pull request #116 from runger1101001/dev
runger1101001 Oct 3, 2021
3fff22a
inline to low-side for BG431B ESC1 and pid removed antiwindup comment
askuric Oct 3, 2021
36226d0
typo in sensor.h
askuric Oct 3, 2021
dbac40c
Merge branch 'master' into dev
askuric Oct 3, 2021
66d3c33
fuller readme
askuric Oct 3, 2021
ed90016
fix typo in css
askuric Oct 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 54 additions & 3 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,62 @@ jobs:
build:
name: Test compiling
runs-on: ubuntu-latest

strategy:
matrix:
arduino-boards-fqbn:
- arduino:avr:uno # arudino uno
- arduino:sam:arduino_due_x # arduino due
- arduino:samd:nano_33_iot # samd21
- adafruit:samd:adafruit_metro_m4 # samd51
- esp32:esp32:esp32doit-devkit-v1 # esm32
- STM32:stm32:GenF1:pnum=BLUEPILL_F103C8 # stm32 bluepill
- STM32:stm32:Nucleo_64:pnum=NUCLEO_F411RE # stm32 nucleo
- arduino:mbed_rp2040:pico # rpi pico

include:
- arduino-boards-fqbn: arduino:avr:uno # arudino uno - compiling almost all examples
sketch-names: '**.ino'
required-libraries: PciManager
sketches-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, nano33IoT_velocity_control, smartstepper_control,esp32_current_control_low_side, stm32_spi_alt_example, esp32_spi_alt_example, B_G431B_ESC1_position_control

- arduino-boards-fqbn: arduino:sam:arduino_due_x # arduino due - one full example
sketch-names: single_full_control_example.ino

- arduino-boards-fqbn: arduino:samd:nano_33_iot # samd21
sketch-names: nano33IoT_velocity_control.ino, smartstepper_control.ino

- arduino-boards-fqbn: arduino:mbed_rp2040:pico # raspberry pi pico - one example
sketch-names: open_loop_position_example.ino

- arduino-boards-fqbn: adafruit:samd:adafruit_metro_m4 # samd51 - one full example
platform-url: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
sketch-names: single_full_control_example.ino

- arduino-boards-fqbn: esp32:esp32:esp32doit-devkit-v1 # esp32
platform-url: https://dl.espressif.com/dl/package_esp32_index.json
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino, esp32_current_control_low_side.ino, esp32_spi_alt_example.ino

- arduino-boards-fqbn: STM32:stm32:GenF1:pnum=BLUEPILL_F103C8 # bluepill - hs examples
platform-url: https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json
sketch-names: bluepill_position_control.ino, stm32_i2c_dual_bus_example.ino, stm32_spi_alt_example.ino

- arduino-boards-fqbn: STM32:stm32:Nucleo_64:pnum=NUCLEO_F411RE # one full example
platform-url: https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json
sketch-names: single_full_control_example.ino, stm32_spi_alt_example.ino



# Do not cancel all jobs / architectures if one job fails
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@master
- name: Compile all examples
uses: ArminJo/arduino-test-compile@v1.0.0
uses: ArminJo/arduino-test-compile@master
with:
libraries: PciManager
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, nano33IoT_velocity_control
arduino-board-fqbn: ${{ matrix.arduino-boards-fqbn }}
required-libraries: ${{ matrix.required-libraries }}
platform-url: ${{ matrix.platform-url }}
sketch-names: ${{ matrix.sketch-names }}
sketches-exclude: ${{ matrix.sketches-exclude }}
44 changes: 26 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,32 @@ Therefore this is an attempt to:
- ***NEW*** 📢: *Medium-power* BLDC driver (<30Amps): [Arduino <span class="simple">Simple<b>FOC</b>PowerShield</span> ](https://github.com/simplefoc/Arduino-SimpleFOC-PowerShield).
- See also [@byDagor](https://github.com/byDagor)'s *fully-integrated* ESP32 based board: [Dagor Brushless Controller](https://github.com/byDagor/Dagor-Brushless-Controller)

##### <b> Release notes be:</b> <i>Simple<b>FOC</b>library</i> v2.1.1
> - bugfixes commander
> - bugfix `voltage_limit` when provided `phase_resistance`
> - bugfix `hall_sensor` examples
> - added examples fot the PowerShield
> - added initial support for `MagneticSensorPWM`
> - SAMD51 support
> - **initial support for Raspberry pi Pico**
> - added examples to find the raw max and min of the analog and pwm sensor
> - extension of the `Commander` interface
> - added pwm centering option `WC`
> - added pwm modulation cmd `WT`
> - improved esp32 implementation to avoid the need for mcpwm.h changes by @tschundler
> - issue #62: motor.shaft_angle setting in the motor.initFOC()
> - issue #76: esp32 division by zero
> - issue #46: commander end of line character - by @maxlem
> - [community fix](https://community.simplefoc.com/t/as5600-dead-spot-around-0/208) AS5600 register value
> - renamed `Pullup::EXTERN` and `Pullup::INTERN` to `Pullup::USE_EXTERN` and `Pullup::USE_INTERN`

<blockquote class="info">
<p class="heading">NEW RELEASE 📢: <span class="simple">Simple<span class="foc">FOC</span>library</span> v2.2 - <a href="https://github.com/simplefoc/Arduino-FOC/releases/tag/v2.2">see release</a></p>
<ul>
<li>Sensor floating point error bugfix (initial solution) #83, #37</li>
<li>Sensor class restructuring - <b>slight API change</b> - <a href="https://docs.simplefoc.com/sensors">docs</a></li>
<li>Restructured the generic code and simplified adding new mcus: <b>IMPORTANT: an additional compiler flag needed for PlatformIO</b> see <a href="https://github.com/simplefoc/Arduino-FOC/issues/99">issue</a> and <a href="https://docs.simplefoc.com/library_platformio">PlatformIO docs</a></li>
<li>Removed initial jump #110, #111</li>
<li>Double to float transformation of the code - performance increase by <a href="https://github.com/sDessens">@sDessens</a> (#100), <a href="https://github.com/KaSroka">@KaSroka</a> (#100) </li>
<li> <a href="https://docs.simplefoc.com/docs_chinese"><b>Docs webiste translated to Chinese!</b></a> 🎉: Awesome work 😃 by <a href="https://github.com/MINQING1101">@MINQING1101</a>, <a href="https://github.com/Deng-ge-open-source">@Deng-ge-open-source</a> and <a href="https://github.com/mingggggggg">@mingggggggg</a></li>
<li>New MCU support - <a href="https://docs.simplefoc.com/microcontrollers">docs</a>
<ul>
<li>Support for arduino leonardo #108 </li>
<li>Initial support for portenta h7 board in collaboration with <img src="https://docs.simplefoc.com/extras/Images/arduino.png" height="15px"><a href="https://www.arduino.cc/">Arduino</a></li>
<li>Initial support for esp8266</li>
</ul>
</li>
<li>Low side current sensing initial support - <a href="https://docs.simplefoc.com/current_sense">docs</a>
<ul>
<li>Initial support for stm32 B_G431B_ESC1 by <a href="https://github.com/sDessens">@sDessens</a>: PR #73</li>
<li>Initial support for samd21 by <a href="https://github.com/maxlem">@maxlem</a>: PR #79</li>
<li>Initial support for esp32 by <a href="https://github.com/maxlem">@byDagor</a></li>
</ul>
</li>
</ul>
</blockquote>

## Arduino *SimpleFOClibrary* v2.1

Expand Down
112 changes: 112 additions & 0 deletions examples/hardware_specific_examples/B_G431B_ESC1/B_G431B_ESC1.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/**
* B-G431B-ESC1 position motion control example with encoder
*
*/
#include <SimpleFOC.h>

// Motor instance
BLDCMotor motor = BLDCMotor(11);
BLDCDriver6PWM driver = BLDCDriver6PWM(PHASE_UH, PHASE_UL, PHASE_VH, PHASE_VL, PHASE_WH, PHASE_WL);
LowsideCurrentSense currentSense = LowsideCurrentSense(0.003, -64.0/7.0, OP1_OUT, OP2_OUT, OP3_OUT);


// encoder instance
Encoder encoder = Encoder(HALL2, HALL3, 2048, HALL1);

// Interrupt routine intialisation
// channel A and B callbacks
void doA(){encoder.handleA();}
void doB(){encoder.handleB();}
void doIndex(){encoder.handleIndex();}

// angle set point variable
float target_angle = 0;
// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }

void setup() {

// initialize encoder sensor hardware
encoder.init();
encoder.enableInterrupts(doA, doB);

// link the motor to the sensor
motor.linkSensor(&encoder);

// driver config
// power supply voltage [V]
driver.voltage_power_supply = 12;
driver.init();
// link the motor and the driver
motor.linkDriver(&driver);

// current sensing
currentSense.init();
// no need for aligning
currentSense.skip_align = true;
motor.linkCurrentSense(&currentSense);

// aligning voltage [V]
motor.voltage_sensor_align = 3;
// index search velocity [rad/s]
motor.velocity_index_search = 3;

// set motion control loop to be used
motor.controller = MotionControlType::velocity;

// contoller configuration
// default parameters in defaults.h

// velocity PI controller parameters
motor.PID_velocity.P = 0.2;
motor.PID_velocity.I = 20;
// default voltage_power_supply
motor.voltage_limit = 6;
// jerk control using voltage voltage ramp
// default value is 300 volts per sec ~ 0.3V per millisecond
motor.PID_velocity.output_ramp = 1000;

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

// angle P controller
motor.P_angle.P = 20;
// maximal velocity of the position control
motor.velocity_limit = 4;


// use monitoring with serial
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);

// initialize motor
motor.init();
// align encoder and start FOC
motor.initFOC();

// add target command T
command.add('T', doTarget, "target angle");

Serial.println(F("Motor ready."));
Serial.println(F("Set the target angle using serial terminal:"));
_delay(1000);
}

// angle set point variable
float target_angle = 0;

void loop() {
// main FOC algorithm function

// Motion control function
motor.move(target_angle);

// function intended to be used with serial plotter to monitor motor variables
// significantly slowing the execution down!!!!
// motor.monitor();

// user communication
command.run();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-DHAL_OPAMP_MODULE_ENABLED
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
*
*
* STM32 Bluepill position motion control example with encoder
*
*
* The same example can be ran with any STM32 board - just make sure that put right pin numbers.
*
*
*/
#include <SimpleFOC.h>

Expand Down Expand Up @@ -32,10 +32,10 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }


void setup() {

// initialize encoder sensor hardware
encoder.init();
encoder.enableInterrupts(doA, doB, doI);
encoder.enableInterrupts(doA, doB, doI);
// link the motor to the sensor
motor.linkSensor(&encoder);

Expand All @@ -54,32 +54,32 @@ void setup() {
// set motion control loop to be used
motor.controller = MotionControlType::velocity;

// contoller configuration
// contoller configuration
// default parameters in defaults.h

// velocity PI controller parameters
motor.PID_velocity.P = 0.2;
motor.PID_velocity.P = 0.2f;
motor.PID_velocity.I = 20;
// default voltage_power_supply
motor.voltage_limit = 6;
// jerk control using voltage voltage ramp
// default value is 300 volts per sec ~ 0.3V per millisecond
motor.PID_velocity.output_ramp = 1000;

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

// angle P controller
motor.P_angle.P = 20;
// maximal velocity of the position control
motor.velocity_limit = 4;


// use monitoring with serial
// use monitoring with serial
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);

// initialize motor
motor.init();
// align encoder and start FOC
Expand All @@ -89,15 +89,15 @@ void setup() {
command.add('T', doTarget, "target angle");

Serial.println(F("Motor ready."));
Serial.println(F(("Set the target angle using serial terminal:"));
Serial.println(F("Set the target angle using serial terminal:"));
_delay(1000);
}

void loop() {
// main FOC algorithm function
// the faster you run this function the better
// Arduino UNO loop ~1kHz
// Bluepill loop ~10kHz
// Bluepill loop ~10kHz
motor.loopFOC();

// Motion control function
Expand All @@ -109,7 +109,7 @@ void loop() {
// function intended to be used with serial plotter to monitor motor variables
// significantly slowing the execution down!!!!
// motor.monitor();

// user communication
command.run();
}
Loading