# DUO-X

THE PROBLEM STATEMENT
To construct an autonomous machine(15x25cm minimum size) which searches for a vacant place in a jammed parking lot and “parks” itself there without touching any other vehicle present there. After a delay of a few seconds, it has to come out of there and park itself in the next vacant place.

THE ALGORITHM

This was the first complete algorithm. It has been modified a little during the completion of the bot.

int turnvar=1,left=0,right=0;
while(1)
{
if(s2=0 && s4=0 && s5=0)
{
if(turnvar ==1 || turnvar==2)
{
turn_hard_right();//turns bot 90 degrees on spot to right
ctr1(); //starts counter 1
right=1;
turnvar++;
}else if(turnvar==3)
{
calibrated_right_turn();//turns bot right based on calculated steps
turnvar++;
}else
{
turn_right();//turns right 90 degrees abt left wheel
ctr2();//starts counter 2
right=1;
turnvar++;
}
}else if(s1==0 && s3==0 && s5=0)
{
if(turnvar ==1 || turnvar==2)
{
turn_hard_left();//turns bot 90 degrees on spot to left
ctr1();
left=1;
turnvar++;
}else if(turnvar==5 || turnvar==6)
{
calibrated_left_turn();//turns bot left based on calculated steps
turnvar++;
}else
{
turn_left();//turns left 90 degrees abt left wheel
ctr2();
left=1;
turnvar++;
}
}else if(s5 == 1)
{
park();
}else go_forward(); //goes forward predetermined steps
}
park()
{ if(ctr1()!=0)
{
if(right == 1)
{
stop_ctr1();
parking_indicator();//turns on a led for sometime
while(ctr1()!= 0)
{
go_back(); //goes back predetermined steps
decrement_ctr1();
}
turn_hard_left();
right=0;
}
else if(left ==1)
{
stop_ctr1();
parking_indicator();
while(ctr1()!=0)
{
go_back();
decrement_ctr1();
}
turn_hard_right();
left=0;
}
}else if(ctr2()!=0)
{
if(right==1)
{
stop_ctr2();
turn_left();
parking_indicator();
turn_left();
while(ctr2()!=0)
{
go_forward();
decrement_ctr2();
}
turn_right();
}
else if(left==1)
{
stop_ctr2();
turn_right();
parking_indicator();
turn_right();
while(ctr2()!=0)
{
go_forward();
decrement_ctr2();
}
turn_left();
}
}

## Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

This was the arena for the bot. the "fixed" cars are permanently there and the 'non-fixed" cars can change their locations.

Your post is in the past tense. Is this a challenge that you already competed in? If so, how'd it go?
yeah i already completed it. i did it with one of my friends. it went fine... we had one problem. the bot detected the black coloured cars as blank spaces and wanted to park there and so there was some accidents :)   we faced this problem as the event was organised at night time
I inspire your robot design.It's nice and good shape.
thanks leonarul.. actually acc to the problem statement we had to build a 15x25cm (minimum size) bot and our bot was exactly that size :)