Society of Robots - Robot Forum

Software => Software => Topic started by: abhishek.kr on December 02, 2012, 03:48:43 PM

Title: Follower
Post by: abhishek.kr on December 02, 2012, 03:48:43 PM
I am trying to solve a problem statement which has a grid as shown in attachment.
I have to move my robot to 2 coordinates[like-(2,1) and (3,2)] SPECIFIED AT THE TIME OF RUN(have to choose the shortest path).but I am stuck in coding.Some some one help me with codes(It would be great if u could provide the codes)?Arena specification is this:
The arena will be made of 2 types of square cells,(see Figure)
Type A: Black grid of dimension 300mmX300mm.
Type B: Black square of dimension 300mmX300mm and at the centre of it is white square of dimension 180mmX180mm.The arrangement of the cells will be completely random in the competition.
Starting and finishing zones are of dimensions 200mmx200mm.
All white lines are of 30mm width.
Nodes are present at the intersection point of two white lines. It is a square of dimension of 30mm x 30mm.Node scan be of Black colour or same as that of lines i.e white.
Please Help!!
Title: Re: Grid follower
Post by: jwatte on December 04, 2012, 12:28:36 AM
What, specifically, do you need help with?
What's your budget?
Do you have anything available already -- hardware, software, sensors, advisors?

If I were to solve this problem, I'd buy a kit, such as the 3pi robot, with a multi-sensor line detector, such as a 6-wide or 8-wide phototransistor board, and a microcontroller (probably AVR based, there is one built into the 3pi already, or maybe an Axon) to read the sensor and tell the robot what to do.
To program the robot the coordinates, you need either some buttons and a simple display on the robot itself, or just hard-code the coordinates in your program, re-compile, and re-upload once you know what they are.

3pi robot + programmer: http://www.pololu.com/catalog/product/1306 (http://www.pololu.com/catalog/product/1306)
Line sensor: http://www.pololu.com/catalog/product/961 (http://www.pololu.com/catalog/product/961)
Axon microcontroller: http://www.societyofrobots.com/axon2/ (http://www.societyofrobots.com/axon2/)

The actual code you need to write varies wildly based on the specifics of your microcontroller, your sensors, and your motor control system.
Title: Re: Grid follower
Post by: abhishek.kr on December 04, 2012, 07:45:09 AM
I will be using ATMEGA-32 controller,I am Planning to use 5 sensor array(If u suggest some other please specify),Motor which I am using is DC.
I can't use ready made kits,So Pololu can't be used,other than that I am not sure if pololu kits are available in my country.
In the beginning only Grid is given,coordinates of Nodes are not specified.We have to build an autonomous robot,which performs following task.Main task is:

1. There are two runs, first is the dry run and second is main run.
2. During the dry run the bot has to map the positions of the nodes in the 5x5 grid. There will be two nodes on the grid(colour of nodes will most probably be Black but it's not specified so I have to be prepared for other cases too) and position of nodes will be declared just before the match. Time for dry run is 3 minutes. we have to complete the run within 3 minutes.There will be two nodes on the arena.
3. During the main run the bot has to move to the nodes and display the colour code of four squares around that node. Bot will firstly move to the node whose y-coordinate is least of the two nodes.
4. When the bot reaches to the first node, it will save the number of white squares around that node as y1 and the x-coordinate of that node as x1. And similarly for second node bot will save y2 and x2.
5. Bot will then move to (x1,y1) and (x2,y2) respectively. When it moves to the respective coordinates, it has to display the colour code of four squares around that coordinate.
6. When it reaches to (x1,y1) and reads the surrounding square cells, the number of white squares detected around (x1,y1) will denote x3 and when it moves to (x2,y2) number of black squares around (x2,y2) will denote y3.
7. After that the bot will finally move to the final coordinates (x3, y3) and display the colour code of the four squares around that coordinate and LED configuration has to be on until the organizer asks them to switch it OFF. Bot has to stop at the final coordinate (x3, y3) and the task is considered over.
8. When the bot reaches any assigned coordinate it has to show the colour code of four squares to which that coordinate is common. These squares are the 4 surrounding squares around the coordinate.

This is the main task which I want to perform.What I thought for this is,I will scan whole grid in my dry run and than store the value of node(store coordinates of nodes)in my controller but I am stuck with the coding as in how do I store the value of nodes in my controller so that in the MAIN RUN I am able to go there in minimum time and also bit in scanning part.
Not for node colour problem,I thought to use a switch which can be toggled according to the condition.
Title: Re: Follower
Post by: jwatte on December 04, 2012, 12:31:38 PM
That's a fair bit of additional information!

You have to break the problem down into sub-sections. For example, how can you tell that you're at an intersection of grid positions?
How can you tell the color of the squares around that grid position?
If the width of the grid is 30 mm, and the width of the border around white cells is 30 mm, then I'd use two sensors per 30 mm (Nyquist sampling theorem) and I'd want to read 5 things wide -- a total of 10 sensors, spread over 135 mm.

Anyway, to store information, check into the eeprom_write() and eeprom_read() functions of the AVR standard C library. They allow you to store permanent information that survives a reboot (but by default not a re-flash.)

Title: Re: Follower
Post by: abhishek.kr on December 04, 2012, 01:03:45 PM
That's a fair bit of additional information!

You have to break the problem down into sub-sections. For example, how can you tell that you're at an intersection of grid positions?
How can you tell the color of the squares around that grid position?


Yes we will have to break it in sub-sections.

Intersection can be found by the sensor value.Two cases would be there:
1.If all the sensors are at white than it's a normal intersection.
2.If the middle sensor is at black while all the others at white we have a node(supposing node is black)

For square colour I wanted to use 4 Digital sensor around robots.Suppose my robot is a square I would place my 4 sensors at the four corners of that,moving out and facing down(hope you get what I am trying to say.)

While I am using a 5 sensor array to sense line,as lines are 30mm wide so I was thought I will keep 3 sensors within these 30 mm at proper distance,while two sensors would be at extreme.

I am confused with the coding as in how to store the value of:
1.Number of intersection crossed.
2.If node found how to store those values.
3.How to define direction(north ,east...etc..)

I am dropping my email id in your Personal message.If you have any sample codes for these please provide.

Also I am attaching a file with dimensions of grid.

Thank you!!
Title: Re: Follower
Post by: abhishek.kr on December 04, 2012, 01:05:36 PM
Also I am not familiar with Nyquist Sampling theorem. :(
Title: Re: Follower
Post by: waltr on December 04, 2012, 07:10:36 PM
Also I am not familiar with Nyquist Sampling theorem. :(

Google it.
Title: Re: Follower
Post by: abhishek.kr on December 05, 2012, 04:36:18 AM
Google it.
[/quote]

Ok.Can you help with Programming part?Any sample code for these types of problem?
Title: Re: Follower
Post by: Admin on December 15, 2012, 01:02:51 PM
This should help you:

http://www.societyofrobots.com/programming_wavefront.shtml (http://www.societyofrobots.com/programming_wavefront.shtml)