Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Gyro Returning Values Not According to Actual Robot Movement (http://www.chiefdelphi.com/forums/showthread.php?t=124899)

theonlydvr 19-01-2014 07:11

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);
    }
}

chassis is our RobotDrive object
rightStick is our right joystick object and vice verse for leftStick

Thanks for any help

BradAMiller 19-01-2014 08:29

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.

theonlydvr 19-01-2014 09:47

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.


All times are GMT -5. The time now is 22:35.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi