Right motor inversion doesn't work
sciencewhiz opened this issue · 2 comments
As reported in wpilibsuite/frc-docs#1571, the right motor isn't inverted on the Romi. Note that I haven't tested this, but looking through the firmware it looks to be true.
Here it calls the RomiMotor call to flight the right motor.
wpilib-ws-robot-romi/firmware/src/main.cpp
Line 331 in 13dd76c
However, the RomiMotor class isn't actually used to write the values to the motor. Instead the Servo class is used here:
wpilib-ws-robot-romi/firmware/src/main.cpp
Line 293 in 13dd76c
Thus the inversion would need to be implemented before the call to the Servo class in order for it to be used.
This may have been masked previously since DifferentialDrive inverted automatically, but that was removed for 2022.
Closing this. The servo class is only used if any of the 5 available GPIO pins are configured as PWM outputs. The motors are controlled via the RomiMotor class:
wpilib-ws-robot-romi/firmware/src/main.cpp
Line 305 in 13dd76c
Thus if both motors are given the exact same value, they should spin in opposing directions
To close the loop. The right motor is inverted on the Romi 32U4 board, so this uninverts it to act more like a typical FRC robot that is wired red to red. Thus software inversion is necessary, and the previous comment on frc-docs was wrong about not needing to invert the right motor.