Robot in 2 Days Code
Tags: controlPersonhours: 10
Since we chose to build on the swerve platform that we developed over the summer, we needed to make some additions to the code for the swerve platform. The swerve module is built up of two separate rotating parts, a platform, or as we like to call it, a frame, and we have the swerve module itself. While coding the swerve module in the summer, we decided to ignore the rotation of the frame and just focus on translation in the direction that we wanted for simplicity’s sake. We could accomplish this with just one encoder; however, in order for Swerve to be competition ready we need to be able to control the rotation of the platform too. To accomplish controlling the rotation, we decided to drive one of the Omni wheels that were there previously to balance the mono swerve platform. We accounted for this by implementing an unwrapping function based on input from the IMMU in the control hub that helped maintain global bearing despite platform rotations due to the driven Omni wheel. This gave us the ability to decouple the direction of the swerve module and the platform and naturally created a field-oriented driving system.