Page 1 of 1

Author:  Shark0 [ Mon Jul 18, 2011 2:51 am ]
Post subject:  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

#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;

Author:  jbflot [ Mon Jul 18, 2011 8:49 am ]
Post subject:  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:

Author:  jokai [ Wed Oct 05, 2011 3:08 am ]
Post subject:  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.

Author:  jbflot [ Wed Oct 05, 2011 9:36 am ]
Post subject:  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:

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

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.

Author:  jokai [ Thu Oct 06, 2011 1:59 am ]
Post subject:  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.

Author:  jbflot [ Thu Oct 06, 2011 8:56 am ]
Post subject:  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: ... -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?

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group