The attached code does not work for square dance three. If I replace lines 4 to 7 with a right turn, it works fine. I also notice that the waitUntil is in purple. Any suggestions would be appreciated or is there a problem with the robotC graphical compiler with the waitUntil in the repeatUntil loop?

The waitUntil that color because it is inside another loop. That color does not mean the compiler does not recognize the commands. I'm having a hard time understanding your question. You say that the code does not work, unless you replace lines 4-7 with a right turn. But, isn't that was the code does on the code you attached? Thanks,

Sat Jul 19, 2014 5:04 pm

rseniuk

Rookie

Joined: Thu Jun 19, 2014 9:25 pmPosts: 34

Re: Square Dance Three Code Question

Yes, the code I attached should do exactly what a right turn does, but when compiled and downloaded to a robot, the robot will not execute the right turn using the gyro.

Ok, thanks for the clarification. I think the problem is that the forward command is blocking the rest of the program. The robot never gets out of the forward command because it can't move that amount forward because of the obstacle in front of it. Please let me know if that makes sense. Thanks,

Sat Jul 19, 2014 8:07 pm

rseniuk

Rookie

Joined: Thu Jun 19, 2014 9:25 pmPosts: 34

Re: Square Dance Three Code Question

The program runs up until the virtual robot starts to turn to the right. It waits for the box to move, starts forward for 7.45 rotations, stops, starts turn to right and goes about 135 degrees, instead of the 90 in the condition. I have changed the -90 to -50 and it still moves the same amount.

I tried to replicate the problem with your robot turning with the code, but the robot won't move from the beginning. The overall issue, though, is the Forward command. It is holding up the program flow, preventing it from reaching other blocks that need to check other sensors. The sensors aren't being continuously checked because the forward command block takes too long to run. I hope that helps. Thanks,

Mon Jul 21, 2014 7:25 am

rseniuk

Rookie

Joined: Thu Jun 19, 2014 9:25 pmPosts: 34

Re: Square Dance Three Code Question

Good Morning

Once again I was kicked out of posting to this forum when I was logged into the robotC forums.

I have a hard time believing the forward command is the problem. Program flow is sequential and the conditions are not checked until the statement is finished processing. You are using the squareDanceThree board in the curriculum challanges to test the code. Also the attached code for square dance two works fine. The only difference is the distance checking condition.

The robot waits until the box moves till it starts on its way down the side of the box.

I went ahead and placed a stopAllMotors command after the waitUntil command. It solved the issue with the robot over-turning. The robot was being told to wait until the Gyro Sensor had a reading less than -90, but was not told what to do once it received that value.

Mon Jul 21, 2014 9:44 am

rseniuk

Rookie

Joined: Thu Jun 19, 2014 9:25 pmPosts: 34

Re: Square Dance Three Code Question

Thanks

The stopAlllMotors command works. It makes sense that the motors have not been told to do anything else, so they keep turning, even though the robot has rotated the required -90 degrees.

I looked in the Q&A and it says that you have to check the keep logged in box otherwise you are automatically logged out after a time periiod. If you take a long time to type your message, you are logged out and have to log back in. Mifght be something you want to mention to the class, so they don't get frustrated trying to compose messages.

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum