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.
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.
Thank you for your answer.
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?
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):
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.
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.
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.