Greetings: I’m currently working on implementing the Gyro sensor for our team in the Autonomous phase. I started by making a code that would turn the robot a certain number of degrees at a desired power level using the Gyro sensor, which I found fairly straightforward. However, I hit a roadblock when I went to create a function that would use the Gyro heading value and have the robot continue in a straight path even if it were to be interfered with or the wheels weren’t exactly in sync. Another team suggested using encoders on the motors for this, however my team is tight on our budget and can’t afford to use encoders, so we will have to resort to using the Gyro and wait commands in autonomous. If anyone has a code that they could share or something that would point me in the right direction on how to accomplish this, it would be greatly appreciated.
*what kind of drivetrain? skid-steer, swerve, mecanum, omni, other?
Mecanum
You can use a gyro to maintain the heading of a bot (i.e. keep it pointed in the same direction).
If you keep a skid-steer pointed in the same direction it will, for the most part, drive in that direction
With a mecanum, the bot can drift left/right (strafe) without turning, so keeping it pointed in the same direction doesn’t necessarily prevent it from drifting sideways.
If your mec bot drifts left/right or rotates when given a pure forward command, my suggestion would be to work on the mechanical and electrical aspects of the drivetrain to correct that as much as possible before turning to software solutions.
Thanks for your suggestion - I just realized that it actually was a hardware issue with the wheels and the axle collars. I should have checked that sooner.