#ifndef TR2ROBOT_H #define TR2ROBOT_H /* DISPLACEMENT structure This structure contains the displacement from the robot's current location to a subgoal or the goal. The displacement is in feet as float values. */ typedef struct { float x; float y; } DISPLACEMENT; /* LOCATION structure This structure contains the location of either the goal or the robot's current position. The location is in feet as float values. */ typedef struct { float x; float y; } LOCATION; // Function Prototypes /* Function SetGoal is used to set the goal in the workspace. This function expects the goal in feet as type LOCATION. SetGoal generates paths from every cell in the grid to the goal. If paths for the selected goal have already been generated by the last call to SetGoal, the paths will not be regenerated. SetGoal returns 0 if the selected goal is out of the bounds of the grid or if the selected goal is an obstacle; it returns 1 if neither of these conditions is found. */ int SetGoal ( LOCATION * goalLocation ); /* Function NextSubgoal is used to find the displacement to the next subgoal (which may be the goal itself) from the current location. This function expects the current location in feet as type LOCATION. It also expects a variable of type DISPLACEMENT into which it places the displacement in feet from the current location to the next subgoal. NextSubgoal returns 0 if there is no subgoal (i.e., the displacement is 0 in the x and y directions) or if the current cell is an obstacle; it returns 1 if neither of these conditions is found. A positive displacement in the x direction indicates a move to the right, i.e., +x in array/image coordinates (AIC); a negative displacement in the x direction indicates a move to the left (-x in AIC). A positive displacement in the y direction indicates a move down (+y in AIC); a negative displacement in the y direction indicates a move up (-y in AIC). */ int NextSubgoal (LOCATION * currLocInFeet, DISPLACEMENT * subgoalDispInGridels, int &, int &); /* Function IsGoal is used to determine if the current location is the goal location. This function expects the goal and current locations in feet as type LOCATION. It returns 1 if the locations are the same; otherwise, it returns 0. The tolerance is the number of feet between which the current and goal locations may differ and still allow the function to conclude that the goal and current locations are the same. */ int IsGoal ( LOCATION * goalLocInFeet, LOCATION * currLocInFeet, float tolerance ); /* Function AdvanceCurrLocation is used to add the displacement to the current robot location to obtain the new current location. This function expects the current location in feet as type LOCATION and the displacement in feet as type DISPLACEMENT. The current location parameter passed in will be updated with the new current location. There is no return value. */ void AdvanceCurrLocation (LOCATION * currLocInFeet, DISPLACEMENT * subgoalDispInFeet); #endif