What is up with VEX's Yaw Rate Gyroscope?

What is up with VEX’s Yaw Rate Gyroscope? It doesn’t seem to work in EasyC and Robot Mesh’s Python, but works fine in PROS. I know that I seem to be discluding RobotC here, but I have not had the opportunity to test it much, so any information regarding the quality of gyroscope readings in RobotC would be a big contribution to my knowledge as well. In short, why does it work with some languages and others not?

Technically none of those are languages. C and Python would be the languages used.

Back to the point: RobotC does also support it. The quality of readings depends on whether/how the developers coded the software to clean up the raw signal. I know RobotC, for one, seems to clean up a lot of dirty signals from sensors.

@Barin, thanks for the speedy response.

So, would these be referred to as development environments?

Also, I know there is a way to get raw signals from analog sensors, so would it be possible to interpret the raw signal in a way that would clean it in order to obtain more precise values?

That would probably be a pretty accurate description of them.

My preferred way of cleaning up the values is usually to simply divide the values you get (don’t bother trying to get the raw values) by 10 and round/truncate to the whole number. Then just work with those new values in your code.

Here is some sample RobotC code that would accomplish this:

#pragma config(Sensor, in1,    gyro,           sensorGyro)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

int adjustedGyroReading; //Integer = automatically truncates to the whole number

task main(){
  while(true){ //Infinite loop

    adjustedGyroReading = SensorValue[gyro] / 10; //Sets variable to the actual reading divided by 10 (and truncates - see above)
    ///                                                                             ///
    ///  Insert code here                                                           ///
    ///  The code should use 'adjustedGyroReading' in place of 'SensorValue[gyro]'  ///
    ///                                                                             ///


Edited for brevity and conciseness.

I’ll just chime in that I think it does not work with easyC, although easyC itself, and VEX too, would like you to think otherwise. We tried to use it last year, and spent probably 20 hours between the coaches and the team trying to program and test it, and the response of the data to the cortex was so laughably slow as to be completely unusable. I posted a question to the forum last year (I think?) asking about it, but there were no respondents using easyC. And the most un-helpful respondents said, “use RobotC”.

In our trials, the robot overshot its target by like 20 degrees, and after it stopped, took another 1-2 seconds to print its current heading to the LCD screen, and even that value was off compared to where the robot was actually pointing. And this was in a super-stripped-down program, with no other code that could be affecting the functioning of the sensor or cortex.

We gave up, and my daughter would still like to have the 12 hours back that she spent trying to make it work.

We are using RobotC this coming year, so we will be running the same test programs in the new language and see what happens. It better work. Obviously it works well for some people. For us, it was incredibly frustrating.

Leslie Peters, coach
Renegade Robotics, Team 1666

By the way, I believe sometimes gyroscopes may have a negative value in ROBOTC. If the prongs are facing upwards, then turning right will have a value lower than 0, as turning left will has a value higher than 0. Is this something you are talking about?

Positive and negative values are desirable for this sensor.

In easyC, the sensor gives positive values if you turn it in one direction (for the sake of argument, clockwise), and negative numbers if you turn it the other way from its starting orientation (in this example, counter-clockwise).

If you have the sensor upside-down (which we did at one point), it’s really not a big deal. I just means that for your robot, counter-clockwise will give positive numbers, and clockwise will give negative numbers. You just need to know in your own initial testing what actions of the robot produce what values of the sensor, and work with that. We’ve made a lot of mistakes, so we know a lot of these things…


i know for a fact it works in robotc. Vex for Competition Tutorial | Sensor Programming Part 2 - YouTube at 17mins
This video explains the gyro in robotc