CMPE 117 - Homework 4
The Assignment: A Light-Seeking Robot
You have to write the Esterel code for a robot that seeks the
light, and is a happy companion, almost like a pet.
The robot is intended to be used indoors, and should try to move to
regions of higher illumination, while avoiding obstacles.
A possible starting point for the code is the
example given in class.
The one of the above example can be improved in many ways:
- The robot tries to find regions of higher illumination by
checking a small angle from its line of travel. Perhaps, from now and
then it should stop and do a careful full-circle sweep? What are good
ways of doing this, given that you don't know when you have turned
full circle?
- Obstacle avoidance does not work well; perhaps, if it bumps too
often, it should change strategy?
- The pet, or rather, the robot, should not move incessantly; this
can be unnerving to the owner. Once it finds some region of
relatively high light, and cannot find obvious improvements, or after
it has been changing direction of travel all the time, or when it's
uniformly dark (you decide), it may go in a sleep mode. It should
wake up from the sleep mode when it feels a bump (don't wake up your
pets with a kick, though), or when the light levels change suddenly.
- Add your own ideas to the above.
The goal is for you to make a smart robot, and to write some
beautiful, structured, and superbly commented
Esterel code. The main criteria for evaluation will be structure of
the program, clarity, elegance, and sophistication in the robot model,
and in the use of Esterel.
In particular:
- Organize the state of the robot in "modes", and organize the mode
changes, with suspensions, mode switches, and pre-emptions as
appropriate.
- Try to experiment with various Esterel commands, including loops,
traps, suspends, and so forth. You will be penalized if you stick to
the same control structures throughout the code. Try to use always
the most approprite and elegant way to achieve a goal.
- Try not to write long lists of sequential code, as in the
example: structure your code, instantiate modules instead.
The goal is for you to learn embedded programming and Esterel.
While the robot must seek the light in some reasonable way, the
structure of the program is at least as important.
In other words, we prise more the intelligence of the pet, than its
light-seeking performance (otherwise, we would all have moths as
pets).
Homework Submission
Submit the esterel program as an attachment by email to
luca@soe, by Friday May 17. Indicate in the assignment with whom you
worked, and which portions of the program you were responsible for.
Luca de Alfaro