Question: function [ u , stop, info ] = robot _ guidance ( t , lidar _ scan, wheel _ encoders, info ) % robot guidance
function u stop, info robotguidancet lidarscan, wheelencoders, info
robot guidance function
This will be called by the sim robot interface. This function receives
sensor data which you can use to compute wheel speed commands that will be
used to steer the robot down the corridor. Output should be the rotation rate
of each wheel in rads The example code here creates a randomly driving
robot.
Arguments:
t the current time in seconds Zero is the unix epoch midnight
GMT on
lidarscan a structure with fields:
lidartheta a vector of angles rad where there is a lidar distance
reading available. An angle of is straight ahead of the robot.
The axis of rotation is vertically up and rotations are
righthanded.
lidarrange a vector of distance readings from the lidar m
corresponding to the angles in lidarrange
wheelencoders a structure with fields:
left encoder count for rotation of the left wheel. Positive is the
robot moving forward.
right encoder count for rotation of the right wheel. Positive is
the robot moving forward.
Returns:
u a x array giving the commanded rotation rate rad s for the
left and right wheels. Left wheel should go in the first entry and
right in the second.
stop boolean, true if you want the robot to stop because you have
finished your task. False if you want to keep going
info anything you want to save. This will loop back in the outer
managament code will give it back to you next time this function runs
so if you need to keep track of anything between runs you can put it in
here. Make it an array, cell array, structure, whatever you like.
speed rand;
turnrate ;
u speed turnrate ;
if absmeanu
u u normu;
end
u u;
stop false;
end
Edit this code in a way that lidar information received back helps the robot redirect its direction if its too close to a wall. The robot will randomly be placed in the floor on a hallway and must reach a final destination about a meter away right at the center of the hallway, but must be directed based on the information received back by a lidar scan sensor
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
