Question: I need help creating code for a robot that will be going down a hallway and needs to stop 1 meter before hitting the end
I need help creating code for a robot that will be going down a hallway and needs to stop meter before hitting the end of the hallway. The robot is placed at a random initial point and needs to center it's self and go straight while using a lidar scan.
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.
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
