Gyro degrees

Trying to program degrees but the rotation continues to blow past the value set…sample program has 120.6 degrees when rotating. Why not 120? Just going for simple shapes and need to set angles. Is it trying to emulate…
image
New to this program but would like my students to be able to use correct angles.

1 Like

Set the turn velocity down to one and got it to work once. The angle of 330.4 was an attempt to get consistency with an angle that would work like the 120.6.

1 Like

One common culprit with this sort of thing is that the “drive heading in degrees” will probably never be exactly equal to 120.6 due to various factors. So instead you should probably wait until the heading is either less than or greater than 120.6 as appropriate.

5 Likes

I was trying to avoid that but I feel that would do it. Thanks

2 Likes

@holbrook Good info. Would this still be the case even with a gyro?

Yes, it’s probably more important to take this into consideration on a physical robot than it is on the virtual one.

2 Likes

My thoughts were, since this is a virt bot that the computer would hit what ever entry was put in. Clearly there is an accuracy issue related directly to the real hardware we would normally use in class. No worries there if I had known. After changing the values from an = to >or< it tended to work most of the time. Since the solution provided on the site for the challenge I was having my students do used the = rather then , I had no reason to question until I started testing options. Here is a copy of the “draw a triangle using a gyro” challenge. gyro code level 1 Thank you all for your quick responses as I was able to share this with my students.

1 Like

Would it not be better to use the “turn to heading X degrees” block though?

image

1 Like

That is another option. As long as the results are the same, I don’t see why not. That’s the beauty of it.

Oh definitely, exploring lots of different ways of doing the same or similar things is important.
The main difference between the two (and this also applies to a physical IQ robot with a gyro) is that the turn to blocks have some integrated proportional control to help deal with overshoot which you would need to consider and handle manually using the wait until block.

1 Like