![]() |
Can I use gyro to drive straight in teleop period?
I wanted to know if you can drive straight using the gyro sensor because we don't have encoder to correct the speed of each motor. We're using tankdrive and right now the problem we're facing is that it's not going in the direction we wanted. For instance, if we move left and right stick to up direction the robot doesn't go straight, and for some reason, I think the speed of left side of the robot is going faster then the right side.
Also, I wanted to know if we can use it in autonomous mode. Like I need help with turning the robot with gyro (corresponding the wheel with the gyro angle.) This is our first year so we're rookie, and their no programming mentor to mentor us. |
Re: Can I use gyro to drive straight in teleop period?
It would be very helpful with encoders but it is possible to do it without. Consider the differential of the two tank sticks is directly proportional to the turning rate of the robot. The bigger the difference, the faster the robot should turn. And the turning rate of the robot is the raw output of the gyro (rotational velocity). So in theory, you can do this:
Code:
double drivePower = (leftStick + rightStick)/2.0; |
Re: Can I use gyro to drive straight in teleop period?
Quote:
EDIT: I didn't internalize that you were using tank drive. You could still try to use this, but it might be a little harder to adapt. I suppose if you run this method only when both joystick values are within some value of each other, it might work. |
Re: Can I use gyro to drive straight in teleop period?
Quote:
|
Re: Can I use gyro to drive straight in teleop period?
Here is the code from our FTC library.
Code:
/** |
Re: Can I use gyro to drive straight in teleop period?
Quote:
|
| All times are GMT -5. The time now is 06:33. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi