EasyC Default Code

Our software team was looking to find the default code to EasyC. We don’t know if there is one, one of our mentor’s does think there is one. Can anyone reffer us on where to get it?

There really isn’t a “Default” code. What you do is open EasyC, then click on the button that looks like the FIRST logo. “New Competion Template”. Click that and that is what is called the default code.

Then you start programming your drive functions in OperatorControl. Make sure you put a while loop in there first, then put your code inside the while loop.

I highly recommend that you download and watch this video:

Link to Videos

As Chakorules already explained, there is no ‘default’ code. All the code you will need for your robot you can write yourself. This may sound difficult, but it’s really quite simple. There are 7 tutorials in the help file that will lead you from RC programming, to running with the camera autonomously. Each of these tutorials has a saved project in the tutorials folder that you can open to view the end result of the tutorial.

I am digging the EasyC software. A couple of questions, though, that I haven’t figured out yet. So for the gyro sensor, I understand it is set up for the kit gyro. What if we are using a 300 deg/sec gyro? Is there any way of changing the gyro code? Is it integral to the WPLib? I think I remember reading somewhere else that it is proprietary or a portion is proprietary to other software so we can’t have the source right? Now Kevin Watson has got some very nice code for gyros (amongst a bajillion other things) that can be used. How can we import other C files? It would be nice to take Kevin’s code and make an EasyC library, I just can’t seem to figure it out though.

EasyC should work fine with any gyro you hook to it.

If it doesn’t please post.

I would take a guess that it would work, but the units would be incorrect. The kit gyro has an output sensitivity of 12.5mV per degree, you will have to compare this to whatever gyro you are using, and scale it correctly.

For refrence, an Analog Devices ADXRS300 has an output of 5mV per degree. This means that you need to edit: multiply (not divide) the number you get from easyC by 2.5 (12.5 mV / 5 mV) in order to get real degrees.

Brad would know for sure, but I think that is how it works.

Hmmm sort of sounds right, but wouldn’t you have to multiply? For instance, say the robot moves 1 degree…with the 80 you would get 12.5 mV and with the 300 you would get 5 mV. If the gyro code is unchanged then it would return a value 2.5 less than the real value (12.5/5) which means you would have to multiply to achieve the correct heading. Or am I having a brain fart?

Heh. Yah, I meant multiply. I guess I was having the brain fart.

Cool, well thanks for the idea we will try it out. I would rather fix it at the front end, but if this works, good enough! I just want to make sure our kids are able to use EasyC since they have ZERO programming experience. Although they did whip up a “Hello World!” program today!

You can write a user function to do the scaling and call that rather than using the GetGyroAngle block.

If I can get one and put it into WPILIb, then we might be able to do an EasyC version with it. We’ll do a post if we can do it.

That sounds great, although if it’s just a matter of scaling it should be no problem (I hope). We are building our robot chassis/drive similar to last year (2wd with casters) that is able to spin pretty fast which makes me concerned that the KOP gyro will over-range, thus we want to use the 300 deg/sec model. I will post when we try it out and see how it works with EasyC. Should be within the next week.

There is also a 150 deg/sec from the same manufacturer as the unit in the KOP. That is plug and play compatible with the one in the KOP.

Yeah I believe our 300 deg/sec one is from the same manufacurer too so all is good in theory land!

UPDATE: We mounted our 300 deg/sec rate gyro from Analog Devices and used the EasyC gyro code successfully. As previously discussed, multiplying the final output from EasyC by 2.5 gives the correct heading (in tenths of a degree). It works very well!