# We need GPS expert's help!

When we use the GPS example from VRC code, we always see those examples have inertial sensor on the drive train but at same time, they have GPS also. However, our robot has no inertial sensor, so we couldn’t find the block for “turn to heading x degree”.

If we use that example on our drive train with GPS only (we change the GPS portal accordingly), our robot keep rotating without any forward and reverse move.

The difference between our robot and the VEX example are that we have no inertial sensor, and our drive train use motor groups. We expect any GPS expert can save us. Thank you.

I don’t really understand the question you have.

If you have one GPS sensor, you can either assign it to the drivetrain or use it as an independent sensor when using blocks. If the drivetrain has no sensor (inertial or gps), the turnToHeading and turnToRotation blocks are not available as the drivetrain has no knowledge of the heading or rotation angle.

3 Likes

If I understand you correctly, if the GPS is independent to the drive train like in our case, and the drive train has no sensor, then how to use GPS to control the robot?

Or if we have no inertial sensor, what we can only do is to assign the GPS to the drivetrain, am I right? Thank you so much

You would need to write code using the values obtained from the GPS sensor, its heading and location, to directly control the drivetrain.

yes, the GPS sensor will need to be able to see and detect the GPS field strip.code for this to work.

3 Likes

Thank you very much. According to your great suggestions, we assign the GPS to the drivetrain as following:

However, when we use the VEX example block code to run it, it always tell error as following (although we don’t use python, but it says something about python):

Could you keep helping me out?

Unless I can’t see it, you are missing parenthesis on your travel distance… or you could just use the square command (x^2). Not sure if this is your problem, but you’re probably getting some really bad calculations from this.

Also, a BIG programming hint, when you’ve got problems like this, is to display current data (gps, motor temp, ‘x’ position, ‘y’ position, motor degrees, etc) on the brain followed by an immediate 5 second delay.

This gives you long enough to read the data before it begins the next move. You can catch (debug) a code pretty easily this way.

I can’t see all of your code, but perhaps try the VEXcode update they released tonight and see if that fixes the issue.

2 Likes

Thanks. We use block to program it, not python or C language.

Thanks. The code in blocks is VEX official example. The weird thing is that we never used python or c language, but when we run the blocks, the error always come out like the above screenshot.

That’s because the blocks need to be converted to text to be able to be run on the V5 brain. It used to be C++, but recently the VEXcode team decided to switch to Python, hence all the Python errors as Python detects these at runtime whereas C++ would have caught them during the compile stage prior to downloading to the brain.

3 Likes

I went back and looked at the math in the x2+y2 section. That looks right. I just couldn’t see it close enough when I looked.

I’d still go back and add the ‘display’ and ‘pause’ commands, then check the brain’s output.

Also, the ‘printposition’ subroutines are not shown… maybe code problem is in there.

Could reset brain and push code in again. This has solved problems several times in the past.

Finally… just do it again from scratch and save into a a different slot. I’ve seen block code get corrupted on more than one instance.

1 Like

Thank you so much for all of those great suggestions. That will save us a lot of time by telling the possible situation. I will have a try and let you experts know the result.

I am so curious about the angle theta. If the robot head is facing west like -50 degree (heading read by the GPS), if the robot turn right for the angle theta, it will not face the target. It should turn right by 50 plus theta degree. However, when I read some GPS code examples, there is nothing regarding that. All of the code just say turn the degree theta which I can’t figure out.