代做ELEE 4200、MATLAB程序语言代写
2023-10-04
ELEE 4200/5200: Autonomous Mobility RoboticsTerm I, 2023Homework 2: Open-Loop & Closed-Loop DrivingNote:• The broad goals of this assignment are:o To implement a basic closed-loop control algorithm, which requires the use of afeedback 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 morethan 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 consultwith others in developing solution ideas, but the final code implemented must be yourwork product alone. Refer to the Syllabus, where the policy on academic integrity isoutlined, our classroom discussions on this topic, and consult with me and/or the GTA ifyou have any questions!Background:In Homework 1 we drove the robot using velocity commands that were either fixed entirelyor fixed over driving segments (the ‘6’ & ‘9’ patterns). In all cases, the program did notincorporate the right feedback, even as we implemented a control system! This is because wewere not monitoring the proper variable as the robot drove. The aim of this assignment is to goone 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 thendrove it for the estimated time it would take to travel a distance equal to the circumference ofthe circle. However, this strategy assumes that the robot achieves the desired velocityimmediately, even though it is starting from a stationary position. This would obviously not betrue in practice. In fact, we can prove it would not by getting the robot to trace a full circle afterit has had time to reach the target velocity. The circle would be slightly different in thissituation.Furthermore, even if the robot achieves the commanded velocity instantaneously, typicallythe ground is non-uniform in terms of its friction characteristics as well as flatness. So, inpractice velocities are not constant all the time. The vehicle’s internal speed control systemtries 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.2We can in a sense say that in HW1 we implemented an open-loop control system, becausewe did not monitor the correct target quantity of distance traveled. Instead, we monitoreddrive time, which is inherently based on the assumption that the velocity will hold steady. Inthis homework we will monitor distance traveled instead, which is downstream from time oftravel, and is not dependent on the assumption of a steady velocity. It is a better indicator ofwhether we have traveled as far as we want. In fact, we will do both so that you can comparethe results obtained.Figure 1: Desired Triangular Robot PathCBAAB = 3 metersAngle A = 600Angle B = 600xyNOT TO SCALE!3Tasks:1. Drive the robot counterclockwise around the triangular path shown in Figure 1 from theassumed starting position of the origin of the World Frame. First, do it with an open-loopstrategy as follows:a. Drive the robot straight at a chosen fixed forward velocity ‘v’ for the estimated time tocomplete 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 timeto point to the next vertex, based on a chosen rotational rate ‘’. This is known as astop-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 drivingstraight 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 onspecifically driving a desired distance or turning through a desired angle, but using drivetime 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 arenot ready yet.• Do not attempt to tune the driving time based on how the path looks on a particulartrial and re-running the experiment. That is, if the side of the triangular path is too longor too short, or the turn angles are less than or greater than the desired angle, leave italone! Because such a strategy is not practical! Additionally, if the completed path is nota closed triangle, do not attempt to close it. The idea is to assess the disadvantages ofan open-loop driving strategy, not to fix it through iteration, because again, that isimpractical!2. Repeat the above task, this time using a closed-loop driving strategy. That is, monitor thedistance the robot travels using odometry, to know when you have completed each side of thetriangle. Similarly, monitor the angle of turn accomplished at each corner, before stoppingthe 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.4Related 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 thisin a separate video!Important general advice:• In any assignment there are always parts whose details are not exactly specified. I am notreferring here to missing information that should have been provided – you must have thatinformation! I am talking about missing details in the solution strategy, where you need touse your creativity to find the answers. This is how you develop your own abilities! There isno process for which every step is fully laid out!• When you are writing or debugging an algorithm, being calm helps! During the debuggingprocess, when the program does not work, you can check the code. However, typically it isbetter to look at the intermediate results at appropriate points in the program to guide youon which part of the code you should check for correctness! When you check code, you arechecking inputs. It is possible you discover errors this way, but it is more productive to checkwhat 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 inresponse to the requirements for Homework 1. Building on something from before is alwaysmore efficient than starting from the beginning again! In addition, I am providing samplecode 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 strategythat 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 theclockwise 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. Forexample, there are two basic robot moves – go straight and turn-in-place. Therefore, it wouldhelp to write two MATLAB functions that execute these moves, so that you can call themrepeatedly rather than copying the code multiple times. I am not requiring this here but keepit in mind as a step to improve program efficiency.5What to submitWhen you respond to the requirements of this homework, focus narrowly on the followingitems (and use the numbering scheme for responses!):1. Task 1: Drive open-loop around triangleI. 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 triangleI. Plot of path using odometry. [3]II. Plot of path using model state. [3]III. MATLAB code + explanation of algorithm. [4]TOTAL: 20