IllinoisRoboticsInSpace / IRIS

Illinois Robotics in Space 2022-2023 Season
https://iris.ae.illinois.edu/
8 stars 0 forks source link

[Systems] Arduino Motor Driver Initialization and Configuration Files(v0.0.1) #27

Open ttchalakov opened 8 months ago

ttchalakov commented 8 months ago

The Arduino Motor Driver's public interface (for version 0.0.1) has an initialization procedure and then a repeated update function. In this post we will discuss the initialization procedure for version 0.0.1 of the arduino motor driver.

The MotorDriver class has constructors that should initialize its state, however an initialization function is necessary so that an error code can be returned if the initialization doesn't work, for instance, a serial connection was not able to be made or some other error occurs. Apart from errors, at initialization all sabertooths should have their serial communications established.

Another useful feature for the initialization procedure is to make structs or objects that store configurations for the motor driver. This is important to have because the way that the motor driver is configured for teleop mode is different then for autonomous mode. Therefore a configuration should store for each motor their ID, their baud rate, serial address, the arduino serial pins they are connected to, their directionality, and anything else you think is relevant.