I-Bug is in an unknown environment with obstacles. The tower emits an infrared signal, and the robot's plan is based on sensing the intensity of this signal.
There are three tasks, which are each separate threads.
(1)The main() task
(2)The ir_follow() task
(3)The boundary() task
The main task is always scheduled to start first.
It schedules the ir_follow() task to start before the boundary() task.
This allows the ir_follow() task to grab the mutex for the motors, moveMutex, first.
By using various indicator variables, boundary() cannot grab moveMutex until ir_follow() sets these variables,
and similarly, boundary() uses indicator variables to prevent ir_follow() from grabbing moveMutex.
The robot alternates between the ir_follow() task and the boundary() task
until it satisfies the termination condition.
Sensors: 2 touch sensors, 1 infrared sensor
Love the Jittery Robot :D
asingh53 1 year ago