W2023 Firmware Architecture
Goal: Figure out a way to send commands from the Jetson to Cytron/other PWM motor controllers, via an intermediary system or other method, and read information back from those motor controllers (e.g: encoders on the motors).
Requirements:
Needs to be able to powered by the battery/another rail
Should be fast < 200ms response
Controllable via Jetson pinout
Needs to send commands over PWM
Should be able to read from it as well; not only write (in case of encoders)
Architecture decisions:
Decide on second board/module to use to use (e.g: nucleo or Adafruit 16-Channel I2C servo driver)
Nucleo:
Customizable
Hard real-time
Already have multiple boards in the bay
Familiar to firmware team
Extensible
Slowest to get working (freeRTOS, multiple threads, etc.)
Adafruit:
Has up to 12 PWM outputs
Has no customizable MCU; cannot write custom code, cannot read from encoders
Fastest to get working
Arduino:
Easy (libraries)
Fast to set up
Decide on which RTOS to use (freeRTOS cool w yall?)
HAL
Decide on which protocol to use to communicate from Jetson to nucleo if using nucleo; CAN or I2C?
Tasks to Allocate:
Create a new repository for firmware
Use STM32CubeIDE to set up the project with both freeRTOS and the STM32HAL; upload to the repository
Create ~4 threads running from functions in separate files such that work can continue concurrently
Create PWM code for basic control of current science mechansim motors
Create PWM code for basic control of gimbal servo + gimbal slip ring motor
ODrive wiring for arm
Create code for reading and writing data over /CAN; assume the data coming from the Jetson over I2C/CAN is a struct such as the following:
-> Gimbal servo desired location (0 to 360 deg)
-> Gimbal slip ring desired location (0 to 360 deg)
-> Science mechanism fan speed
-> Science mechanism drill speed
-> Science mechanism pulley speed
etc...