Writing in NXTG ver 2
While writing this program, I came across an almost identical snippit solution from Brian Davis. A perfect match I thought!
The only problem is that it does not work (at least mine doesn't). The program hunts down targets (Bottles) inside a ring
of black tape. When it encounters the ring, it stops right on cue in the exception loop. The problem is that it remains locked
in the exception loop. The mode changes appropriately but it will not transit back to the original loop. I have attached a pack
and go for inspection. The normal (lower loop) runs fine,hunting and attacking objects as it finds them.
Any assistance would be welcomed.
Thanks,
Bill C.
Dual Concurrent Loop Problem
Dual Concurrent Loop Problem
- Attachments
-
- Skittles.rbtx
- (601.85 KiB) Downloaded 236 times
-
- Posts: 346
- Joined: 27 Sep 2010, 03:05
- Contact:
Re: Dual Concurrent Loop Problem
I'm not totally sure, but I'll take a guess on this one.
One thing that you're doing in this program that can cause problems is that you're trying to control the motors from two different loops. Meaning the main loop may tell motor A to go forward 5 degrees, but the sensor sees a line, so the exception loop tells the motor to back up. The motor will backup and wait for the next command, but the main loop is still waiting for the motor to drive forward 5 degrees.
Using a "State Machine" like you have is an excellent way to control the robot. The ability to change the "Mode" value from different places in the program can work very well. You just want to control your motor from a single location (in the switch), and have another Mode that causes it to backup if it sees a line.
Hope that helps
Steve
One thing that you're doing in this program that can cause problems is that you're trying to control the motors from two different loops. Meaning the main loop may tell motor A to go forward 5 degrees, but the sensor sees a line, so the exception loop tells the motor to back up. The motor will backup and wait for the next command, but the main loop is still waiting for the motor to drive forward 5 degrees.
Using a "State Machine" like you have is an excellent way to control the robot. The ability to change the "Mode" value from different places in the program can work very well. You just want to control your motor from a single location (in the switch), and have another Mode that causes it to backup if it sees a line.
Hope that helps
Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
Who is online
Users browsing this forum: No registered users and 4 guests