function [Utemp, FLAG_terminate] = ROB535_ControlProject_part2_Team3(TestTrack,Xobs_seen,curr_state) % [Utemp, FLAG_terminate] = ROB535_ControlProject_part2_Team3(TestTrack,Xobs_seen,curr_state) % % This script generates control inputs that avoid randomly generated % obstacles along the test track % % INPUTS: % TestTrack the structure loaded from TestTrack.mat % % Xobs_seen the output of the senseObstacles function % % curr_state taken from the last state in Y, where Y is the actual % trajectory updated after forward integrating the % vehicle dynamics using control inputs at every planning % iteration % % OUTPUTS: % Utemp an N-by-2 vector of control inputs that will be passed % to forwardIntegrateControlInput. Utemp must have enough % control inputs with time step 0.01 seconds to forward % integrate vehicle dynamics for the next 0.5 seconds % % FLAG_terminate a binary flag set by the function to indicate when to % stop the simulation. Setting this flag to 1 at a % planning iteration indicates that, after integrating % forward vehicle dynamics using the control inputs from % Utemp for 0.5 seconds, the vehicle would have reached % the goal. If this flag is set to 0, then it imples that % the car would not reach the goal after forward % integrating for 0.5 seconds. Note that, in the event % that FLAG_terminate is never set to 1, the simulation % would stop after 20 minutes so that we can process all % the teams files in a timely manner. % % Written by: Sravan Balaji, Xenia Demenchuk, and Peter Pongsachai % Created: 30 Nov 2021 load('ROB535_ControlProject_part1_Team3.mat'); Y_ref = ROB535_ControlProject_part1_state; U_ref = ROB535_ControlProject_part1_input; obj = MPC_Class(TestTrack, Xobs_seen, curr_state, Y_ref, U_ref); [Utemp, FLAG_terminate] = obj.compute_inputs(); end