|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Gyro Returning Values Not According to Actual Robot Movement [Answered]
Hello everyone,
I am a programmer for team 4338 in Israel and have encountered problems while using the gyro supplied by First. On testing the gyro in operator control using a simple program which printed out the current angle, the printed values began at a negative number near zero and continued slowly increasing minimally only reaching 1 degree after a minute. The robot, however was turning frequently and definitely more than 1 degree. This was our code for operator control: Code:
public void operatorControl()
{
chassis.setSafetyEnabled(false);
gyro.reset();
chassis.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true);
chassis.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
while (isOperatorControl() && isEnabled())
{
chassis.tankDrive(leftStick.getY(), rightStick.getY());
System.out.println("Angle: " + gyro.getAngle());
Timer.delay(0.01);
}
}
rightStick is our right joystick object and vice verse for leftStick Thanks for any help Last edited by theonlydvr : 19-01-2014 at 10:09. Reason: Answered |
|
#2
|
|||
|
|||
|
Re: Gyro Returning Values Not According to Actual Robot Movement
Check that the gyro is connected to Analog port 1 or 2 on the first digital module. Those are the only ports that have the hardware integrators for computing the heading from the gyros rate output.
Also, you can verify the operation of the gyro by just creating an AnalogChannel object on the channel that the gyro is plugged into. Watch the analog output with either a dashboard or print statements and verify that the output is near 2.5V when the robot is stationary. Now rotate the robot in one direction and the values should go either up or down momentarily, then rotate in the other direction and the values should go the other way. But remember, it will only do this while the robot is moving since the gyro is measuring rate of rotation. |
|
#3
|
|||
|
|||
|
Re: Gyro Returning Values Not According to Actual Robot Movement
Thanks for the help!!!
We figured out the problem. We had a faulty analogio breakout and on replacing it our gyro worked fine. Last edited by theonlydvr : 19-01-2014 at 10:08. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|