View unanswered posts | View active topics It is currently Fri Jan 17, 2020 9:20 am

Reply to topic  [ 3 posts ] 
Return to starting position(is this possible?) 
Author Message

Joined: Thu Feb 19, 2015 10:24 am
Posts: 3
Post Return to starting position(is this possible?)
Right now I am still new to RobotC, but It does not seem too different from NXT-G and I am patient enough to learn. I have an algorithm written in NXT-G for a robot competition at my school. Basically it is two robots in an 8x8 square arena and there are blue and yellow canisters. A corner with a light source is where to blue canisters go(which is easy), but the opposite corner is where the yellow canisters go. Is there a way to have the robot know where the center of the arena is after picking up a yellow canister? Any help would be greatly appreciated.

Edit: the only sensors allowed are the ultrasonic, magnetic, color, touch, light and sound.


Thu Feb 19, 2015 10:30 am
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 722
Post Re: Return to starting position(is this possible?)
How is the field laid out, is it a grid pattern (8x8 squares?), and if so how are the squares separated? If the different squares have a distinct separation between each 'tile', you could use the light sensor to count how many lines have been crossed.

Alternatively, you could use the encoders in the motors to keep track of how far the robot has traveled in a given direction, the ultrasonic to see how far away from an object (or wall) the robot is, etc. There are many, many different ways to solve this particular problem; I suggest breaking down the full challenge into step-by-step sections (what the robot is doing first, what it is doing second, what it is doing third, etc) and then breaking each section down into individual behaviors (moving forward, turning, closing the gripper, etc).

This is called behavior based programming, and you can find more information on how to implement it under the 'Thinking About Programming' section found here.

Check out our Blog! And our Facebook page!
Need help? Take a look at our updated help documentation and the ROBOTC Forums.

Thu Feb 19, 2015 1:07 pm

Joined: Thu Feb 19, 2015 10:24 am
Posts: 3
Post Re: Return to starting position(is this possible?)
Thank you for the response John,

Unfortunately the arena is an 8'x8' square with a solid green mat as the surface. The algorithm i have written in NXG allows for collision avoidance and can bring blue canisters to the light corner 100% of the time. My robot actually won the preliminary competition for the school. I have done research on dead reckoning by using the encoders in the servo motor, but I can't seem to find out how to work that into the algorithm. If there is a resource anyone could possibly guide me towards, it would be very much appreciated.

ps. right now the ultrasonic sensor is used to avoid the other robot in the arena, and the walls. Also it is used to let the robot know when to release the blue canister(when it is in the "light" corner). The robot moves in a random motion until the color sensor picks up blue or yellow and the claw closes. The Yellow canisters are magnetic, so the magnetic sensor is used to tell the difference between the two.

Thu Feb 19, 2015 2:16 pm
Display posts from previous:  Sort by  
Reply to topic   [ 3 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.