Back
Stage 01
Objective: Make the Nomad Move down the hall
and count doors as it moves along stopping at a specified door.
What we did:
-
To keep the Scout in the middle of the hall
as it moved we simply set its forward angle to the difference in distance
from the left and right sides of the robot to the hallway wall.
-
To count to doors we simply set a flag when
the distance to a wall was within a specified range. Then, when it exceeded
that range, we knew there was a door there. We did not let the door increment
until the robot saw the wall again.
-
We put all this in a loop that ran until it
counted the correct number of doors.
Stage 02
Objective: Have the robot avoid obstacles
while the it is moving down the hall.
What we did:
-
When certain sonar reaches a certain range
we increment the angle of motion, in such a fashion that as the robot gets
closer to an object it starts to turn more and more.
-
We also included emergency code so that if
the robot got too close anyway, it would come to a complete stop.
Stage 03
Objective: Have the robot go through a given
maze from a specified room and direction to a specified room within the
maze.
What we did:
This project we broke up into two parts:
-
Given some input, have the computer generate
a string of directions to follow, and also the current room from which
we are moving.
-
The second part was simply the robot following
those instructions.
To have the robot generate a string of directions,
we first had the program read a map file; then the program figures out
the shortest path to the destination. We then had that information stored
to an array for the follow instructions
routine to use.
Following the instructions was very easy.
We simply read in the next direction, compared it to the current direction,
and used the results in the form of one or two 90 degree right turns or
one left turn to face the correct direction. We then made another routine
to get to the next room.
The move to next room
procedure simply stayed in between the walls and stopped when it is in
the middle of the room. It knows when it is in the middle of the room by
reading the distance from the robot to the wall in front of it (we made
another data file that tells it how many rooms are left when it reaches
a certain room).
The Final project
To make a high level programming language
for the Nomad.
What we did:
In addition to making an interface where
we could type in a command and have the robot follow that command, we also
made an adaptation to the maze program and included it in the command functions
that we made available. This adaptation was that, instead of simply going
from a specified room to one destination room, now we could go to any sequence
of rooms. In other words, we could now tell it to go from room, say 4 to
5, then 2, then 5, again and so on. We did this by having the user in the
beginning specify a sequence of rooms in the format of 1 4 3 2…. ending
with 0, to stop the robot at the last
room. We then included our previous procedure
into a loop, now taking in the instructions, instead of from a user, now
from an array that contains the string of rooms that the user had previously
specified. Another addition was that we added a function to follow the
closest object to the robot, and yet another function to run from the object
closest to the robot. This
was done by finding the closest object
to the robot and moving that sonar’s number*22.5 direction. The rest of
the project was simply a matter of putting everything else that we had
done to date into a switch statement, and not stopping until a “quit” command
were issued.
The commands are:
turn_right Turns right by 90 degrees
turn_left Turns left by 90 degrees
do_maze Runs the modified maze
program
do_doors Goes down the hall a specified
number of doors to the right or left
go_forward moves forward for a
specified length of time
go_backward Moves backward a specified
length of time
run runs from closest object
follow follows’ the closest object
quit quits the program altogether
This is the code that runs this final project.