ROBOTC.net forums
http://robotc.net/forums/

Can someone give me some code for the gyro
http://robotc.net/forums/viewtopic.php?f=11&t=4805
Page 1 of 1

Author:  themigthy [ Fri Sep 07, 2012 7:44 am ]
Post subject:  Can someone give me some code for the gyro

I have tried using the sample prrograms for basic turn but I can't seam to understand it since the robot does a 90 degree turn and then keeps on turning. So can some one tell me how to do a 90 degree turn?

Author:  Spiked3 [ Fri Sep 07, 2012 12:27 pm ]
Post subject:  Re: Can someone give me some code for the gyro

What gyro? Does it provide raw data or euler angles? (http://en.wikipedia.org/wiki/Euler_angles)

It takes some math, to turn 90 degrees using the encoders. Code for this is included in my lib at http://www.spiked3.com/?p=410

The more common basic way to do it is to simply wait an amount of time previously determined by trial and error.

So an example might be;

Code:
nSyncedMotors = synchBC;
nSyncedTurnRatio = -100;

motor[motorB] = 40;
wait1Msec(125);      // <- adjust
motorB[motorB] = 0;

with a gyro is a whole new model :) In theory, you read the turn rate sample, multiply that by elapsed time, accumulate to an actual amount turned variable, (optionally fuse with compass heading and encoder data), lower power to 0 as you approach 90 degrees. That's the theory anyhow. I have that as an upcoming project as well. Please let me know if you find something else.

Author:  themigthy [ Fri Sep 07, 2012 12:33 pm ]
Post subject:  Re: Can someone give me some code for the gyro

The gyro is the vex yaw gyro. http://www.vexrobotics.com/276-2333.html

Author:  tfriez [ Sat Sep 22, 2012 8:27 pm ]
Post subject:  Re: Can someone give me some code for the gyro

There are sample programs include with ROBOTC for use with the VEX Gyro Sensor.

You can find these in the C:\Program Files (x86)\Robomatter Inc\ROBOTC Development Environment\Sample Programs\VEX2\Gyroscope folder.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/