Hey there! Really enjoying the Vex VR for my students to play with, but I am confused about how we can drive to a specific location using the “Turn to Heading” block to move from one coordinate to the next in the Secret Message challenge. How do you direct the robot to turn to a specific angle, and then move a specific amount, or point to a specific coordinate. Unless you use a lot of geometry/pythag… and that’s a little beyond what I was hoping for. Am I missing something simple? Any help would be appreciated!
Here is the text of the challenge:
Uncover the secret message using the coordinates below. Use the Turn to heading block and the Pen on the VR Robot, to move from one coordinate to the next in the project below.
No, it’s a secret. But you could, probably, guess it correctly on the first try.
However, you could download *.vrblocks program that I attached to my reply above (look inside triangle) and then upload it to and execute at vr.vex.com to see secret message appear on the screen.
To goal of this lesson is to learn about atan2() function that lets you determine desired heading angle based on the deltaX and deltaY of coordinates that you need to move to.
Regular atan() only returns angle between -90 and +90 deg (i.e. only right side of the circle) and you need to look at signs of both deltaX and deltaY to determine if the heading should be on the other side of the circle.
Then I taught them a tiny to bit of trig teaching them to solve for angle theta using acos with direct lines. I pasted the X-Y grid on this google draw and taught the kids to draw the triangle labeling Theta, the right angle, Side h and side a.
After that, we went over how to calculate the length of the side “a” by subtracting the starting and finishing X values, and had them figure out how to use an if then else to determine if the robot should turn left or right by comparing the Y values with Automatic a.