View unanswered posts | View active topics It is currently Thu Jul 24, 2014 1:52 pm






Reply to topic  [ 6 posts ] 
Gyro 
Author Message
Rookie

Joined: Mon Jul 18, 2011 2:47 am
Posts: 2
Post Gyro
Ive been having trouble programming the vex Gyro scope, its giving me wierd readings it starts from zero and about 4000 and then starts again and it wont respond to the code ive written


Code:
#pragma config(Sensor, in16,    Gyro,                sensorGyro)
#pragma config(Motor,  port1,           LeftD,         tmotorNormal, openLoop)
#pragma config(Motor,  port2,           RightD,        tmotorNormal, openLoop, reversed)
#pragma config(Motor,  port3,           RightL,        tmotorNormal, openLoop)
#pragma config(Motor,  port4,           LeftL,         tmotorNormal, openLoop, reversed)
#pragma config(Motor,  port5,           LeftC,         tmotorNormal, openLoop)
#pragma config(Motor,  port6,           RightC,        tmotorNormal, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main ()
{
 SensorValue[Gyro] = 0;


    while (SensorValue[Gyro] < 90)
    {
      motor[LeftD] = -127;
      motor[RightD] = 127;
    }
  }


Mon Jul 18, 2011 2:51 am
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 403
Post Re: Gyro
Hi Shark0,

The Gyro sensor type in ROBOTC was originally implemented for an older sensor, so the existing calibration is a little off. We're fixing this in an update to ROBOTC in the coming weeks. One article that will help you until then can be found here: http://vamfun.wordpress.com/2011/05/09/note-vex-gyro/

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Mon Jul 18, 2011 8:49 am
Profile
Rookie

Joined: Sat Mar 19, 2011 2:32 am
Posts: 12
Post Re: Gyro
Hi Jesse, I heard the gyro now works with RobotC vs 3.02. However, when I connected the gyro to the cortex the debug window gives me very low values, not 0 -3600. I get values like -1, -2, etc when turning clockwise; this is with the robot continuously spinning as it never reaches my 90 degree value of -900. I switched the gyro to another cortex & it seemed to work but the next day I got the same low values again. What am I doing wrong? Thanks.


Wed Oct 05, 2011 3:08 am
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 403
Post Re: Gyro
I'm not sure what you're doing wrong, but I've found that it's helpful to manually wipe out the gyro configuration data at the beginning of the program, and then reconfigure it, like this:

Code:
  // Completely clear out any previous sensor readings by setting the port to "sensorNone"
  SensorType[in8] = sensorNone;
  wait1Msec(1000);
  // Reconfigure Analog Port 8 as a Gyro sensor and allow time for ROBOTC to calibrate it
  SensorType[in8] = sensorGyro;
  wait1Msec(2000);


This is in place of the pragma statements the Motors and Sensor Setup generates. There's three sample programs available if you go to File > Open Sample Program > Gyro.

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Wed Oct 05, 2011 9:36 am
Profile
Rookie

Joined: Sat Mar 19, 2011 2:32 am
Posts: 12
Post Re: Gyro
Jesse, I've tried using the sample & also doing it thru Motors & Sensor from the Robot drop down menu. Either way, the debug window showed very low values, -1,-2,-3,etc. When I connected it to another cortex, I had the same problem at first then after many tries it worked. But the next day the values on the debug windows were low again. I opened a new gyro & put it on another cortex that had RobotC vs 3.03 (the other one had vs 3.02) & that one worked. But it wouldn't let me change the value in the debug window Sensors screen to 0. It froze the Sensors value so I had to reopen the file, then it worked. Anyway, Downloaded vs 3.03 on the other computer & connected the gyro but it still gave low values so the robot kept rotating. Any idea how to correct this?
Also, when we downloaded a file that was created on either vs. 2.32 or vs 3.02 using the current vs 3.03, our robot just started to turn & raise its arm when the code was for it to just close its claw and move forward. The motors are in the correct ports. We're going to try to copy the code onto a New Competition template using vs 3.03 to see if it still gets erratic tomorrow. Also, with the new vs, we have to power cycle before each download. We get red robot or joystick lites and an error message but when we power cycle, all the lites go back to green & it can download. Thanks.


Thu Oct 06, 2011 1:59 am
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 403
Post Re: Gyro
I honestly haven't seen what you're describing. There's a chance that the original gyro is bad... you might contact VEX Robotics for additional troubleshooting and/or see about a replacement: http://www.vexrobotics.com/products/acc ... -2333.html

I also haven't seen the issue with using 2.32 programs you described, but if you send me the code I'll be happy to check it out and try to offer some insight. I'm assuming that you have updated your Cortex to the latest Master and ROBOTC Firmware?

Red lights tend to indicate low battery. You might check the connectors on your robot and battery to see if any are damaged - making the connection between them shaky. What error message are you getting, specifically?

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Thu Oct 06, 2011 8:56 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 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.