Issues with Autonomous Code
Hello, im new to both the forums and using ROBOTC. I am in a competition in college where we have to build and program an NXT robot to do the following:
1) Avoid obstacles
2) Find objects, small canisters, and tell whether they are trash(dont beep) or nuclear(beep)
3) Take the trash to the corner with a bright light(got this down perfect)
4) Take the nuclear canister to the corner across from the light corner
So I began with just a simple go forward until touch sensor is pressed finding strategy, but once I tried to alter the code to include a turn in while loop, the robot doesnt seem to notice there is a canister in its claw, or at least doesnt for awhile. I know the while condition isnt assesed until after the statement is run, but is there any way i can have it always checking for the canister and keep going 3 feet forward and then turn 195 degrees?
Also, in developing the code to find the nuclear deposit zone, I ran into some issues because one simply cant have the robot find the light corner and then turn 180 degrees and go forward for awhile bc the canisters can be placed anywhere on the field and thus the robot can be at various different angles in respect to the light source. My idea was to have the robot find the light, then slowly turn and as it turns, take in values using the ultrasonic sensor to determine where it is in terms of cardinal directions. So having lots of 'leftwall = true', 'bottomwall = false' type of statements. If you have any ideas or hints that would be wonderful. I look forward to your responce(s)!