Please note the following:1) Please clearly label your solutions to each problem (e.g., Solutions to Problem
1, Solutions to Problem 2, etc.).
2) This project has two problems. All relevant files can be found in the folder
called “Project Materials”.
3) You need to submit a final report that answers the problems, along with
E
necessary derivations and plots.
4) Computer programs and videos are also required to be submitted. Please read
the descriptions of each problem carefully.
5) For Problem 1, the file for the virtual machine is large. We have created a link
for you to download the file from OneDrive (see the Final Project Materials
folder). Please read the supplementary files carefully before you start.
1
Problem 1. (35 points)
Use the Robot Operating System (ROS) and Python to steer and drive the vehicle shown
in the simulation below to follow the trajectory line. Install Oracle VM Virtual Box
software and add the Virtual Machine .ova file provided. ROS and Python and all
prerequisites and dependencies are installed in this Virtual machine file.
The main task is to edit a Python file to write a PD (Proportional-Derivative) controller
code to control the vehicle and send commands via Python-ROS libraries.
Final Submission Requirements/Tasks:
1) (10 points) Install the Oracle VM VirtualBox on your machine and add the Virtual
Machine file to the same (shared with you on OneDrive).
2) (15 points) The final edited control.py file. You can edit the Python file for
submission using the Firefox browser in the Ubuntu VM itself.
3) (10 points) A video of the Ubuntu screen with the simulation map of the vehicle
moving from the starting position to the goal position (a decent video shot from a phone
is fine).
Note: Please upload a video that is less than 30 seconds. A long video is not necessary.
Please read the following documents before getting started:
P1-Supplementary Reading 1
P1-Supplementary Reading 2
2
Problem 2. Wall following problem (35 points)
You are provided with a car that has a LiDAR installed. The LiDAR can send out laser
beams at various angles and output the distance to obstacles at each beam.
In this problem, you are asked to derive equations and write a step-by-step
pseudocode/algorithm, that will make the car follow a wall from a distance. Please
provide a thorough explanation of the work.
Preliminaries:
Figure 1. The geometry layout of Problem 2.
Figure 1 above shows a typical scenario that you will be working with.
• 𝑎𝑎 and 𝑏𝑏 are the two consecutive laser-beam scan distances and 𝜃𝜃 is the angle
between them (known values). (Note that 𝑏𝑏 is the distance measured from the
laser beam perpendicular to the wall when the car moves in parallel with the
wall. 𝑎𝑎 is the distance from next laser beam reading with the known angle 𝜃𝜃.)
• The blue line is the desired trajectory that we want to follow (known).
• 𝐷𝐷 is the distance between the wall and the desired trajectory (known value).
• 𝛼𝛼 is the current yaw angle of the car (an unknown value).
• 𝐴𝐴𝐴𝐴 is the distance of the car to the wall (an unknown value).
Task 1 (10 points): Given the values of 𝒂𝒂, 𝒃𝒃, and 𝜽𝜽, use the geometry shown in
Figure 1 to find equations to solve for 𝜶𝜶 and the distance 𝑨𝑨𝑨𝑨.
3
Now assume that the car is moving at high speeds. The car will not be in the same
position while the control input is calculated. So, the car needs to be projected at a
future time-step. The velocity of the vehicle and step-time is usually used for calculating
and projecting the car at a future time-step. For simplicity, let us assume the car moves
a fixed distance of 𝐴𝐴𝐴𝐴 at each time step. This will lead us to Figure 2 below.
Figure 2. The geometry of car movement under one time step.
In Figure 2, 𝐴𝐴𝐴𝐴 is known (an assumed value). All the other known parameters are
consistent with Figure 1. We have already calculated 𝐴𝐴𝐴𝐴 in Task 1.
Figure 3. The error calculation.
As shown in Figure 3, note that the rotation of the vehicle from left to right is the
negative direction, that is the angle rotated is < 0. The rotation of the vehicle from right
to left is the positive direction, that is the angle rotated in > 0. This is very important in
context to calculate the sign of the error 𝑒𝑒. If the sign of the error is wrong, the car will
move in the wrong direction.
4
Task 2: (10 points) Given known 𝑨𝑨𝑨𝑨, 𝑨𝑨𝑨𝑨, and 𝜶𝜶, calculate the distance 𝑪𝑪𝑪𝑪. Using
𝑪𝑪𝑪𝑪, calculate the error 𝒆𝒆.
Hint: The calculation for the error should be generalized. Your car can either be on the
left side of the desired trajectory or on the right side of the desired trajectory. The sign
of 𝑒𝑒 changes depending on which side you are on. Figure 3 and its explanation give you
an idea about the sign of error 𝑒𝑒 that you need for this task.
Task 3: (10 points) With the error 𝒆𝒆 , write a PID equation that will provide a
control signal to correct the steering angle of the car. Also, provide the equation
for the updated steering angle.
Task 4: (5 points) With the information you have derived from Tasks 1, 2 and 3,
please write a step-by-step pseudocode/algorithm to achieve the wall following
algorithm. Please provide comments wherever required.
5