Every-Flavor-Robotics / motorgo-mini-driver

Driver software for the MotorGo Mini board
MIT License
2 stars 1 forks source link

syntax, controllers work with updated calibration, optional balance p… #51

Closed stilsota closed 9 months ago

stilsota commented 10 months ago

changelog

closes #50

SwapnilPande commented 9 months ago

@stilsota, I've rebased this on the latest version of the driver. If possible, could you download and run the balance bot example and confirm that it is working as expected? If so, this will be ready to merge into dev.

stilsota commented 9 months ago

Just tried it. When I compile it throws this error:

I have a MotorGo 1.2 plugged in with the 2 PTZ motors. It is showing an up to date branch on feature-50/balance-bot-balance-point-tuning

resolved - I was flashing out of the wrong directory.

/Users/tstilson/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: .pio/build/balance_bot/libFrameworkArduino.a(main.cpp.o):(.literal._Z8loopTaskPv+0x8): undefined reference to `setup()'
/Users/tstilson/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: .pio/build/balance_bot/libFrameworkArduino.a(main.cpp.o):(.literal._Z8loopTaskPv+0xc): undefined reference to `loop()'
/Users/tstilson/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: .pio/build/balance_bot/libFrameworkArduino.a(main.cpp.o): in function `loopTask(void*)':
/Users/tstilson/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:42: undefined reference to `setup()'
/Users/tstilson/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: /Users/tstilson/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:48: undefined reference to `loop()'
collect2: error: ld returned 1 exit status
*** [.pio/build/balance_bot/firmware.elf] Error 1
===================== [FAILED] Took 38.56 seconds =====================

Environment    Status    Duration
-------------  --------  ------------
balance_bot    FAILED    00:00:38.555
================ 1 failed, 0 succeeded in 00:00:38.555 ================

 *  The terminal process "platformio 'run', '--environment', 'balance_bot'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 
stilsota commented 9 months ago

Code is compiling but on balance bot and spin 2 motors examples, but the motor calibrations do not appear to be saving to the board.

output from spin 2 motors code:

--- Terminal on /dev/cu.usbmodem1301 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
[  3114][E][esp32-hal-spi.c:178] spiAttachSCK(): HSPI Does not have default pins on ESP32S3!
[  3114][E][esp32-hal-spi.c:215] spiAttachMISO(): HSPI Does not have default pins on ESP32S3!
[  3119][E][esp32-hal-spi.c:247] spiAttachMOSI(): HSPI Does not have default pins on ESP32S2!
Starting Sensor Calibration.
MOT: sensor_direction==CW
Rotating forwards
Rotating backwards
Average Zero Electrical Angle: 0.00
Sensor Calibration Done.
Initialized ch0
Starting Sensor Calibration.
MOT: sensor_direction==CW
Rotating forwards
Rotating backwards
Average Zero Electrical Angle: 0.00
Sensor Calibration Done.
Initialized ch1

Observed behavior:

Troubleshooting steps:

SwapnilPande commented 9 months ago

Just to confirm, you tried another MotorGo board in your troubleshooting steps?

Looking at the serial output you posted, I'm suspicious that the issue is realted to the SPI errors you see before sensor calibration - we should never be trying to use the default pins. Let me dig into that right now

SwapnilPande commented 9 months ago

Ahh I understand the issue. This code should be built against a new version of the motorgo-arduino drivers (in the dev branch in that repo). The names of the pins have changed and that's not been reflected in the main branch yet.

Sorry about the version mismatching going on here. It's a bit hard to keep track of, but these version mistmatches will not be an issue when:

  1. Our board definitions are not changing regularly
  2. We submit our board definitions to be part of the Arduino ESP framework (happening in the next few days)
SwapnilPande commented 9 months ago

This issue has been addressed by #65, merging these changes into dev.