View unanswered posts | View active topics It is currently Sat Aug 30, 2014 8:32 am






Reply to topic  [ 4 posts ] 
Can someone give me some code for the gyro 
Author Message
Rookie

Joined: Wed Dec 21, 2011 4:22 pm
Posts: 26
Post 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?


Fri Sep 07, 2012 7:44 am
Profile
Expert

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 195
Post 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.

_________________
Mike aka Spiked3
http://www.spiked3.com


Fri Sep 07, 2012 12:27 pm
Profile
Rookie

Joined: Wed Dec 21, 2011 4:22 pm
Posts: 26
Post Re: Can someone give me some code for the gyro
The gyro is the vex yaw gyro. http://www.vexrobotics.com/276-2333.html


Fri Sep 07, 2012 12:33 pm
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 602
Post 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.

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Sat Sep 22, 2012 8:27 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.