ELEE 4200/5200: Autonomous Mobility Robotics
Term I, 2023
Homework 2: Open-Loop & Closed-Loop Driving
Note:
• The broad goals of this assignment are:
o To implement a basic closed-loop control algorithm, which requires the use of a
feedback loop directly monitoring the variable to be controlled.
o To compare results with a corresponding open-loop implementation of the same task.
• Guidelines:
o Due date: Monday, October 2, 2023, by 12 Noon.
o If you are an undergraduate student, you are permitted to work in groups of no more
than two students. However, if you prefer to work on your own, that is fine too!
o Submit the report by responding to this assignment posting in Blackboard.
o Each group must work on its own in completing this assignment! Feel free to consult
with others in developing solution ideas, but the final code implemented must be your
work product alone. Refer to the Syllabus, where the policy on academic integrity is
outlined, our classroom discussions on this topic, and consult with me and/or the GTA if
you have any questions!
Background:
In Homework 1 we drove the robot using velocity commands that were either fixed entirely
or fixed over driving segments (the ‘6’ & ‘9’ patterns). In all cases, the program did not
incorporate the right feedback, even as we implemented a control system! This is because we
were not monitoring the proper variable as the robot drove. The aim of this assignment is to go
one step further by driving the robot using the proper feedback to guide it.
Let us take the circle path of HW1 as an example. We set the velocity of the robot and then
drove it for the estimated time it would take to travel a distance equal to the circumference of
the circle. However, this strategy assumes that the robot achieves the desired velocity
immediately, even though it is starting from a stationary position. This would obviously not be
true in practice. In fact, we can prove it would not by getting the robot to trace a full circle after
it has had time to reach the target velocity. The circle would be slightly different in this
situation.
Furthermore, even if the robot achieves the commanded velocity instantaneously, typically
the ground is non-uniform in terms of its friction characteristics as well as flatness. So, in
practice velocities are not constant all the time. The vehicle’s internal speed control system
tries to maintain the commanded velocities, but it cannot achieve this instantaneously. That is,
the velocity fluctuates from moment to moment, just like when we drive a car.
2
We can in a sense say that in HW1 we implemented an open-loop control system, because
we did not monitor the correct target quantity of distance traveled. Instead, we monitored
drive time, which is inherently based on the assumption that the velocity will hold steady. In
this homework we will monitor distance traveled instead, which is downstream from time of
travel, and is not dependent on the assumption of a steady velocity. It is a better indicator of
whether we have traveled as far as we want. In fact, we will do both so that you can compare
the results obtained.
Figure 1: Desired Triangular Robot Path
C
B
A
AB = 3 meters
Angle A = 60
0
Angle B = 60
0
x
y
NOT TO SCALE!
3
Tasks:
1. Drive the robot counterclockwise around the triangular path shown in Figure 1 from the
assumed starting position of the origin of the World Frame. First, do it with an open-loop
strategy as follows:
a. Drive the robot straight at a chosen fixed forward velocity ‘v’ for the estimated time to
complete the first side of the triangle. For this part set 𝜔 = 0.
b. Then, stop the robot at the corner reached and rotate it in place for the estimated time
to point to the next vertex, based on a chosen rotational rate ‘’. This is known as a
stop-turn-go strategy.
c. Similarly, navigate the rest of the triangle.
d. Plot the path of the robot using odometry values.
Note:
• You will use the standard equations of motion for estimating the time for driving
straight and for turning in place:
∆𝑠 = 𝑣 ∗ ∆𝑡
(driving straight)
∆𝜃 = 𝜔 ∗ ∆𝑡
(turn in place)
• This can be considered as an open-loop control strategy since you are not focusing on
specifically driving a desired distance or turning through a desired angle, but using drive
time to achieve these indirectly.
• In fact, the ideal situation would be to have the objective of making it to the next vertex.
However, that would involve simultaneously driving forward and turning (if needed)
towards the next vertex of the triangle. We will not do that right now because we are
not ready yet.
• Do not attempt to tune the driving time based on how the path looks on a particular
trial and re-running the experiment. That is, if the side of the triangular path is too long
or too short, or the turn angles are less than or greater than the desired angle, leave it
alone! Because such a strategy is not practical! Additionally, if the completed path is not
a closed triangle, do not attempt to close it. The idea is to assess the disadvantages of
an open-loop driving strategy, not to fix it through iteration, because again, that is
impractical!
2. Repeat the above task, this time using a closed-loop driving strategy. That is, monitor the
distance the robot travels using odometry, to know when you have completed each side of the
triangle. Similarly, monitor the angle of turn accomplished at each corner, before stopping
the turn. Plot path of the robot using odometry values.
3. Repeat Tasks 1 & 2, this time using the ‘model state’ topic for feedback instead of odometry.
4
Related Information:
• Reading time within your MATLAB programming environment – done in HW1!
• Important - use “reset model poses” between trial runs!
• Angles need to be handled in a special manner – they need to be “unwrapped”. More on this
in a separate video!
Important general advice:
• In any assignment there are always parts whose details are not exactly specified. I am not
referring here to missing information that should have been provided – you must have that
information! I am talking about missing details in the solution strategy, where you need to
use your creativity to find the answers. This is how you develop your own abilities! There is
no process for which every step is fully laid out!
• When you are writing or debugging an algorithm, being calm helps! During the debugging
process, when the program does not work, you can check the code. However, typically it is
better to look at the intermediate results at appropriate points in the program to guide you
on which part of the code you should check for correctness! When you check code, you are
checking inputs. It is possible you discover errors this way, but it is more productive to check
what the code is producing as outputs and then backtrack from there.
• To complete this homework, you might find it useful to build on the code you generated in
response to the requirements for Homework 1. Building on something from before is always
more efficient than starting from the beginning again! In addition, I am providing sample
code that illustrates the basic concept. You can then extend that to complete the work.
Learning Involved:
• What is the difference between open-loop and closed-loop control strategies?
• Why will the robot path (going around the triangle) be open even if we implement a strategy
that specifically calls for returning to the initial robot position?
• What changes need to be made in your program if we wanted to go around the triangle in the
clockwise direction instead?
• Why is angle-unwrapping needed?
• What is the difference between Odometry and GPS?
• Why is it that Odometry eventually fails to track position if we drive long enough?
• The algorithm you are developing can be made more efficient if you use functions. For
example, there are two basic robot moves – go straight and turn-in-place. Therefore, it would
help to write two MATLAB functions that execute these moves, so that you can call them
repeatedly rather than copying the code multiple times. I am not requiring this here but keep
it in mind as a step to improve program efficiency.
5
What to submit
When you respond to the requirements of this homework, focus narrowly on the following
items (and use the numbering scheme for responses!):
1. Task 1: Drive open-loop around triangle
I. Plot of path using odometry. [3]
II. Plot of path using model state. [3]
III. MATLAB code + explanation of algorithm. [4]
2. Task 3: Drive closed-loop around triangle
I. Plot of path using odometry. [3]
II. Plot of path using model state. [3]
III. MATLAB code + explanation of algorithm. [4]
TOTAL: 20