Is a gyroscope necessary when using swerve?
Technically no but you would only be able to drive it using robot relative controls and it would be much harder to program reliable auto modes.Even if you are going to drive robot relative instead of field relative it is nice to have a PID on the heading to lock the robot so it doesn’t drift/rotate slightly while translating ( we did this on our 2015 kiwi bot and it was robot relative in teleop).
so can u explain how navx gyros is implemented on swerve?
Similar to any other gyro on swerve, you would use it to try and maintain a desired heading and if you want the control inputs to always be relative to the field you can rotate them based on the drives current heading.
Strykeforce has a basic swerve drive code posted using their own classes and is also using a navx gyro for it.
Kaleb’s got the right answer here.
The key is that “implementation” has two main components from different engineering disciplines:
- Read the current rotation (“pose angle”) of the robot, in degrees, relative to the field.
- Use the measurement of robot current pose angle to drive motor commands in a specific and useful way.
The answer to (1) will depend on what specific hardware is being used, how it’s connected to the roboRIO, where it’s mounted, etc.
The answer to (2) will depend on “what do you want your robot to do?”. That scope could include things like “drive straight”, field-oriented control, path following… all would be different problems, but all involve getting (1) right first.