ROBOTC.net forums
http://www.robotc.net/forums/

Square Dance Three Code Question
http://www.robotc.net/forums/viewtopic.php?f=78&t=9108
Page 1 of 1

Author:  rseniuk [ Sat Jul 19, 2014 12:45 pm ]
Post subject:  Square Dance Three Code Question

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 code works in square dance two.

Attachments:
SquareDance3.jpg
SquareDance3.jpg [ 65.28 KiB | Viewed 8553 times ]

Author:  parkway [ Sat Jul 19, 2014 5:04 pm ]
Post subject:  Re: Square Dance Three Code Question

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,

Author:  rseniuk [ Sat Jul 19, 2014 5:31 pm ]
Post subject:  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.

Author:  parkway [ Sat Jul 19, 2014 8:07 pm ]
Post subject:  Re: Square Dance Three Code Question

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,

Author:  rseniuk [ Sat Jul 19, 2014 10:19 pm ]
Post subject:  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.

Author:  parkway [ Mon Jul 21, 2014 7:25 am ]
Post subject:  Re: Square Dance Three Code Question

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,

Author:  rseniuk [ Mon Jul 21, 2014 8:51 am ]
Post subject:  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.

Attachments:
squareDance2.jpg
squareDance2.jpg [ 51.5 KiB | Viewed 8494 times ]

Author:  parkway [ Mon Jul 21, 2014 9:44 am ]
Post subject:  Re: Square Dance Three Code Question

Hello,

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.

Image

Author:  rseniuk [ Mon Jul 21, 2014 9:58 am ]
Post subject:  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.

Thanks Again

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/