View unanswered posts | View active topics It is currently Tue Jun 28, 2016 4:00 am

 Page 1 of 1 [ 4 posts ]
 Print view Previous topic | Next topic
Can someone give me some code for the gyro
Author Message
Rookie

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

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 197
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);      // <- adjustmotorB[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
Rookie

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

Joined: Wed Jan 24, 2007 10:42 am
Posts: 620
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
Display posts from previous:  Sort by
 Page 1 of 1 [ 4 posts ]

#### Who is online

Users browsing this forum: powerfull3355 and 1 guest

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

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning