-
Notifications
You must be signed in to change notification settings - Fork 0
Swerve_Drive_Odometry
Shortcuts: | 🧑💻 Code |
🏠 Wiki Home |
🧾 WPILib Docs |
❔ Chief Delphi Forums |
☑️ Project |
---|
- Useful links:
https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/gyros-software.html
- What is odometry?
Odometry is the process of using data from sensors to allow the robot to know where its current position is. For example, if the robot knows that it is moving at heading 0 at 1m/s. After 1s, it must therefore know that it is currently at coordinate (0,1). (this is assuming that bearing 0 is corresponding to the x-axis)
- How to set up odometry in the code?
First, intialise a SwerveDriveKinemtics class, a list of all SwerveModulePosition classes of the motors. Do note that the gyro angle will have to be provided by your IMU's gyroscope. Input the necessary variables to create a new SwerveDriveOdometry class.
- What are the methods of SwerveDriveOdometry:
"className".getPoseMeters() essentially returns the current x and y coordinate of your robot, as well as its current heading.
"className".update() essentially returns the new heading, x coordinate and y coordinate of the robot using the time that has passed.