Driving with Procedures (TEAM)

 

In the last problem set you were asked to use the rotation sensors to implement an accurate 90 degree point turn.

 

Remember that procedures in Ada Mindstorms need to be “nested”:

 

procedure MyProcedure is

 

procedure Proc1 is

begin

end Proc1;

     

procedure Proc2 is

begin

end Proc2;

 

begin

      -- You may use the nested procedures here.

end MyProcedure;

 

 

  1. Put the code for the 90 degree point turn in a procedure with sample header:

 

-- You may change the procedure’s name to whatever the team likes.

procedure Turn_Left_90 is

 

  1. Create another procedure that does a 90 degree point turn in the opposite direction:

 

-- You may change the procedure’s name to whatever the team likes.

procedure Turn_Right_90 is

 

  1. Create 2 additional procedures that will allow your rover to go forward and backwards to a specified distance.

 

-- You may change the procedure’s name to whatever the team likes.

-- You may specify the distance however you wish: by inches, meters, -- turns of the rotation sensor, etc…

procedure Go_Forward(Clicks:Integer) is

procedure Go_Backward(Clicks:Integer) is

 

  1. Make your rover drive in a wavy line loop. (straight, 90 right, straight, 90 left, straight, 90 right, straight, 90 left, straight, reverse, 90 right, reverse, 90 left, reverse, 90 right, reverse, 90 left, reverse).

 

Demo: No demo this week. Please make sure your procedures work: They will be VERY important for the upcoming system problem.

 

Turn in: Turn in a hardcopy of the team’s code as of Part D as a “Listing.”