View unanswered posts | View active topics It is currently Tue Apr 23, 2019 3:56 pm






Reply to topic  [ 9 posts ] 
Square Dance Three Code Question 
Author Message
Rookie

Joined: Thu Jun 19, 2014 9:25 pm
Posts: 34
Post 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 8446 times ]

_________________
www.disneymaingatecondo.com
@Oakwater2739
Sat Jul 19, 2014 12:45 pm
Profile
Moderator
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Post 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,


Sat Jul 19, 2014 5:04 pm
Profile
Rookie

Joined: Thu Jun 19, 2014 9:25 pm
Posts: 34
Post 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.

_________________
www.disneymaingatecondo.com
@Oakwater2739


Sat Jul 19, 2014 5:31 pm
Profile
Moderator
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Post 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,


Sat Jul 19, 2014 8:07 pm
Profile
Rookie

Joined: Thu Jun 19, 2014 9:25 pm
Posts: 34
Post 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.

_________________
www.disneymaingatecondo.com
@Oakwater2739


Sat Jul 19, 2014 10:19 pm
Profile
Moderator
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Post 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,


Mon Jul 21, 2014 7:25 am
Profile
Rookie

Joined: Thu Jun 19, 2014 9:25 pm
Posts: 34
Post 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 8387 times ]

_________________
www.disneymaingatecondo.com
@Oakwater2739
Mon Jul 21, 2014 8:51 am
Profile
Moderator
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Post 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


Mon Jul 21, 2014 9:44 am
Profile
Rookie

Joined: Thu Jun 19, 2014 9:25 pm
Posts: 34
Post 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

_________________
www.disneymaingatecondo.com
@Oakwater2739


Mon Jul 21, 2014 9:58 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.