Go to Post Either this entry is the winner or Andy needs professional help. I can't quite decide which... - Rich Kressly [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 29-01-2015, 16:30
TeamMarcies TeamMarcies is offline
Registered User
FRC #4777
 
Join Date: Jun 2013
Location: Canada
Posts: 9
TeamMarcies is an unknown quantity at this point
Issues with the Gyro - Help

Hey!

We've been trying for hours to fix the issue with our Gyro and we're not sure whether it's a software issue or hardware issue.

Here is our wiring (i only posted links since they are huge images):

http://i.imgur.com/ChcTKaV.jpg

http://i.imgur.com/6MXDKSq.jpg

As we rotate our gyro, we're expecting the gyro pointer to move but it isn't:
http://puu.sh/fcJgn/209d7ff45f.jpg (when we are connected to joystick/communication/code)

This is our code snippet for the gyro to drive forward straight and to drive backwards straight.
Btw, the gyro.reset(); is already called before this thread starts.

Code:
	
        public double gyroSensitivity = 0.05; // (voltage / 1000)

	public void run() { // This method is executed only for DriveForward and
						// DriveBackward
		r.autonomousCounter = 0;
		r.theRobot.setExpiration(0.1);
		while ((Math.floor(r.autonomousCounter / r.loopsPerSecond)) <= DriveClass.seconds) {
			if (RecycleRush.InTeleop) {
				break;
			}
			if (forward) {
				r.theRobot.drive(r.robotDriveSpeed, -r.gyro.getAngle() * r.gyroSensitivity);
			} else if (!forward) {
				r.theRobot.drive(-r.robotDriveSpeed, -r.gyro.getAngle() * r.gyroSensitivity);
			}
			Timer.delay(r.timerDelay);
		}
		r.theRobot.drive(0.0, 0.0);
	}
It drives forward, but does not drive complete straight - same for backwards.

We also made code to make it rotate while its stationary.... We made two methods, one of which we deprecated for now because we found simpler logic.

Code:
	public void DriveRotate(int rotateAngle) {
		r.queueThread(new Runnable() {
			public void run() {
				r.gyro.reset();
				while (r.gyro.getAngle() < rotateAngle) {
					r.theRobot.drive(0.0, 1);
				}
                                r.theRobot.drive(0.0, 0.0);
			}
		});
	}
	
	/* DEPRACATED METHOD
        public void DriveRotate(int rotateAngle) {
		r.queueThread(new Runnable() {
			public void run() {
				r.gyro.reset();
				double angleHeader = r.gyro.getAngle(); // Initial Angle
				while (Math.abs(angleHeader - r.gyro.getAngle()) <= Math.abs(rotateAngle)) { // Rotating
					r.theRobot.drive(0.0, rotateAngle * r.gyroRotationSpeed);
					DriverStation.reportError(r.gyro.getAngle() + "", true);
					Timer.delay(r.timerDelay);
				}
			}
		});
	}*/
We have the Gyro connected to: 0 so this is our declaration:
Code:
    // Gyro - Handles Trajectory Paths
    public int GyroChannel = 0;
    public Gyro gyro = new Gyro(GyroChannel);
Basically, the Gyro isn't working in any way.

Last edited by TeamMarcies : 29-01-2015 at 17:11.
Reply With Quote
  #2   Spotlight this post!  
Unread 29-01-2015, 23:18
ProgrammerMatt ProgrammerMatt is offline
Programmer-Electrical-Mechanical
FRC #0228 (Gus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Southington
Posts: 138
ProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really nice
Re: Issues with the Gyro - Help

Quote:
Originally Posted by TeamMarcies View Post
Hey!

We've been trying for hours to fix the issue with our Gyro and we're not sure whether it's a software issue or hardware issue.

Here is our wiring (i only posted links since they are huge images):

http://i.imgur.com/ChcTKaV.jpg

http://i.imgur.com/6MXDKSq.jpg

As we rotate our gyro, we're expecting the gyro pointer to move but it isn't:
http://puu.sh/fcJgn/209d7ff45f.jpg (when we are connected to joystick/communication/code)

This is our code snippet for the gyro to drive forward straight and to drive backwards straight.
Btw, the gyro.reset(); is already called before this thread starts.

Code:
	
        public double gyroSensitivity = 0.05; // (voltage / 1000)

	public void run() { // This method is executed only for DriveForward and
						// DriveBackward
		r.autonomousCounter = 0;
		r.theRobot.setExpiration(0.1);
		while ((Math.floor(r.autonomousCounter / r.loopsPerSecond)) <= DriveClass.seconds) {
			if (RecycleRush.InTeleop) {
				break;
			}
			if (forward) {
				r.theRobot.drive(r.robotDriveSpeed, -r.gyro.getAngle() * r.gyroSensitivity);
			} else if (!forward) {
				r.theRobot.drive(-r.robotDriveSpeed, -r.gyro.getAngle() * r.gyroSensitivity);
			}
			Timer.delay(r.timerDelay);
		}
		r.theRobot.drive(0.0, 0.0);
	}
It drives forward, but does not drive complete straight - same for backwards.

We also made code to make it rotate while its stationary.... We made two methods, one of which we deprecated for now because we found simpler logic.

Code:
	public void DriveRotate(int rotateAngle) {
		r.queueThread(new Runnable() {
			public void run() {
				r.gyro.reset();
				while (r.gyro.getAngle() < rotateAngle) {
					r.theRobot.drive(0.0, 1);
				}
                                r.theRobot.drive(0.0, 0.0);
			}
		});
	}
	
	/* DEPRACATED METHOD
        public void DriveRotate(int rotateAngle) {
		r.queueThread(new Runnable() {
			public void run() {
				r.gyro.reset();
				double angleHeader = r.gyro.getAngle(); // Initial Angle
				while (Math.abs(angleHeader - r.gyro.getAngle()) <= Math.abs(rotateAngle)) { // Rotating
					r.theRobot.drive(0.0, rotateAngle * r.gyroRotationSpeed);
					DriverStation.reportError(r.gyro.getAngle() + "", true);
					Timer.delay(r.timerDelay);
				}
			}
		});
	}*/
We have the Gyro connected to: 0 so this is our declaration:
Code:
    // Gyro - Handles Trajectory Paths
    public int GyroChannel = 0;
    public Gyro gyro = new Gyro(GyroChannel);
Basically, the Gyro isn't working in any way.
Where are your signal wires? is it the red/black wire that's sideways? id recommend using pwm wire. but anyways, can you preform an analog read on the rate pin and post your results?
__________________
2015-2016 CSA
Software Engineering Student @ Johnson & Wales University
Team 228, Gus Robotics Inc.
Facebook
FLL Mentor for 1107, Edison Eagles!
2015- CT State Champions
2012- WPI Finalist(Thanks 1884 and 549), Spirt, Best Website
2011- WPI Chairman's award winners!
2010- WPI Champions! (thanks 230 & 20), WPI Engineering Inspiration, CT Best Website, CT VEX Champions (VRC228, VRC228b) (21-1-0)
2009- QCC VEX Champions (VRC228) (11-0-0), Innovate Award (VRC228)
Reply With Quote
  #3   Spotlight this post!  
Unread 30-01-2015, 20:48
TeamMarcies TeamMarcies is offline
Registered User
FRC #4777
 
Join Date: Jun 2013
Location: Canada
Posts: 9
TeamMarcies is an unknown quantity at this point
Re: Issues with the Gyro - Help

Just reporting back in to say we have resolved the situation! Thanks for the help!
Reply With Quote
  #4   Spotlight this post!  
Unread 31-01-2015, 10:50
nickbrickmaster's Avatar
nickbrickmaster nickbrickmaster is online now
Not Allowed Near Power Tools
AKA: Nick Schatz
FRC #3184 (Blaze Robotics)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Eagan MN
Posts: 162
nickbrickmaster is an unknown quantity at this point
Re: Issues with the Gyro - Help

If you don't mind, could you post how you solved the problem? I was having similar issues.
Reply With Quote
  #5   Spotlight this post!  
Unread 03-02-2015, 02:51
carrud carrud is offline
Registered User
AKA: Clark Rudder
FRC #2637
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Los Angeles Area
Posts: 20
carrud is an unknown quantity at this point
Re: Issues with the Gyro - Help

yes, please tell us how you resolved this!!!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 18:06.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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