ENG5009 Advanced Control 5 Model Descriptions
run_model.m
This is the main working file for the simulation.
The file is split up into sections. The only sections that need to be altered by you are within the setup simulation and code within the main For loop.
full_mdl_motors.m
This file is a mathematical representation of a four wheeled robot. The robot is run by applying voltages to each of the motors.
The inputs to the model are:
Va – Voltages supplied to each motor. An array with four elements, [VL VL VR VR] The first two are voltages applied to the left side motor and the last two are voltages applied to the right side motors.
The voltage range is -7.4 to 7.4V and YOU should limit within the simulation file.
xi – is the current state of the mobile robot. This is calculated for you in the main working file.
ty, tx, fz and xtra_fric allow simulations involving gradients. These should remain at 0 for this exercise and the assignment
stepsize is the main simulation stepsize and should not be altered. The output of the model is captured in xdot and xo.
The variables of IMPORTANCE are:
xi(13) – forward velocity, v, ms-1
xi(18) – rotational velocity, r, rads-1 xi(19) – current x position, x, m xi(20) – current y position, y, m xi(24) – angle, psi, rad
ObsSenor1.m
sensorout = ObsSensor1(cur_x,cur_y,sensor_pos,psi,Obs_Matrix) cur_x is the current x position of the centre of the robot
cur_y is the current x position of the centre of the robot Sensor_pos is to be kept at [0.2 0]
psi is the current angle of the robot
Obs_Matrix is the obstacle matrix that contains the predefined obstacles
Sensorout returns two variables [LeftS RightS] which are the distance to the nearest obstacle for that sensor. IMPORTANT NOTE when there is no obstacle the sensor returns 1.