Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In the midterm project we develop a robot that had two control tasks: (1) to fol

ID: 3778403 • Letter: I

Question

In the midterm project we develop a robot that had two control tasks: (1) to follow the black line to an intersecting corridor and (2) to execute an appropriate turn at that junction and move toward the target destination. Suppose that there are two global variables named current and target. The variable current is the intersection number and the variable target is the target destination. In the task named navigate, two functions named TL and TR are called to execute a turn to the left or a turn to the right. For the path system shown here, write the code for the navigate task in the space below. You DO NOT have to write the code for the two subroutines TL and TR, but you will have to incorporate the calls to these subroutines. DO NOT WRITE task main() or line_follow(). In order to make this a bit easier, don’t turn off the motors when you reach the final destination.

task navigate()

{

          StopTask (line_follow())

...

     StartTask (line_follow());

}

Start O-

Explanation / Answer

moveLT(int rownumber, int columnumber, int[][] field) { if (columnumber == 0) return; else { if (field[rownumber][columnumber-1] == 1) return; field[rownumber][columnumber-1] = 1; moveRobot(rownumber, columnumber-1, field); field[rownumber][columnumber-1] = 0; } } moveRT(int rownumber, int columnumber, int[][] field) { if (columnumber== 3 && rownumber== 3) { numPaths++; return; } else if (columnumber== 3) return; else { if (field[rownumber][columnumber+1] == 1) return; field[rownumber][columnumber+1] = 1; moveRobot(rownumber, columnumber+1, field); field[rownumber][columnumber+1] = 0; } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote