1. Get familiar with Python development
2. Implement and test proportional control
1. A personal computer
Define a series of waypoints (position and direction), your simulated robot should navigate through those points one by one using P control.
1. Submit a working package on Canvas (Alternatively, you may set up your own Github or bitbucket page. Put the page link in your lab report, see below)
2. Write a lab report and submit it on Canvas in IEEE conference proceeding format: (2-8 pages). You may find an excellent sample report here.
You must have an abstract section.
The introduction topics include, but are not limited to, the application of P control, and other common methods of point tracking, based on your out-of-course research.
You don't need to have a "relevant work" part
Briefly discuss the theory of P control, highlight items you think that is not addressed enough in the classroom, and/or your modification of the P control method.
In the experiment section, select different k values to navigate to a pose that you specified. Plot the resulting path, velocity, and other parameters you find worth noting. You should at least try 3 sets of k values for this task.
Show that you can successfully navigate through at least 3 way points that you specify. The robot should stop at the last way point.
The lab report and program files should be done in pairs of 2 or 3. Between groups, you are allowed to collectively interpret material and understand the course package; sharing code or lab reports will be considered a violation of course policy.
1. 50%: functional code with adequate annotation
2. 15%: well-organized abstract, introduction, and method description
3. 35%: Sufficient-experiment result report, analysis, and discussion
4. 5% bonus max at the discretion of the instructor: improvement of P control
1. No more package is needed.
1. Run E160_gui.py
(If you use python IDLE, simply go File->open->E160_gui.py; then click run (F5))
(If you use Command Prompt/Terminal, navigate to the directory you extracted your course package (Windows, Linux), (mostly you will use `cd Folder_Name`), type `python E160_gui.py` or `py E160_gui.py`).
2. You may see a dialogue window as in Fig. 1. Move the slider bar at bottom, you can manually control the robot.
3. Click any point on the dialogue window, on the command prompt/terminal, and you should be able to see "New desired robot state [x][x].
4. Click "track point" button, you should see your robot is rotating like crazy. This is because "track point" function should be developed by you!
5. Now the slider bar will not function anymore until you click "stop"
1. This is the file you will modify to achieve the P control. This is a class. The __init__() function will be called only once when the dialogue window pops-up. The track_point() function will be called every 0.1 second.
2. Understand goal points:
Goal points is stored as a list in `self.robot.state_des` object of E160_des_state (defined in `E160_state.py`). Each element is in the form of (x, y, theta) in global frame
Modify set_goal_points(self) for points you are going to track. The robot should go to the first destination. For instance:
In the above case, you added way points (100, 20, 1.06), then (110, 30, 1.57)
Internally, object `self.robot.state_des` of `E160_des_state` class stores way points as a list.
When you use mouse to left click a point, the way points you defined in the above python program will be cleared. `self.robot.state_des` will only have the one goal point: the point you clicked.
3. Retrieve destination configurations
Read `track_point(self)` function. There are examples on how to get destination position, current position, current velocity in global and local frame, etc. Note `self.robot.state_des.get_des_state()` will return you the goal position you should navigate to, not the whole way point list that self.robot.state_des internally stored.
Keep in mind, `track_point(self)` is called every 0.1s.
4. Define the criteria for "reaching the vicinity" of the goal position, as proportional control, strictly speaking, will never let your robot reach its destination.
In the above code: if abs(c_posX - d_posX) is a wrong example of criteria for you to determine whether the robot has reached its way point. You need to re-define it.
`self.robot.state_des.reach_destination()` serve as a function to internally report a way point is reached. After this function is called, the `self.robot.state_des.get_des_state()` will return the next way point. Therefore, `self.robot.state_des.reach_destination()` must be called once (and only once) when a way point is reached.
`self.robot.state_des.reach_destination()` will return `True` if you have reached the last point of the the way point list (and thus the motors should stop); the function returns `False` if it only reaches a midway point.
5. `self.robot.set_motor_control(c_v, c_w)` will result in motor to move. You only need to specify x-direction velocity and angular velocity. You do NOT need to specify the wheel speed.
6. `self.robot.send_wheel_speed(phi_l = 6.0,phi_r = 6.0)` allows you to update the wheel rotation velocity (unit in rad/s). You must calculate the wheel speed yourself. (The robot chassis diameter is 2L=24cm, the wheel radius is r=3cm). Please try to calibrate your wheel speed to be less than 16 rad/s. The simulator will function normally if the wheel speed is beyond 16 rad/s. However, the counter for "wrong frame" will be added.
1. In`__init__(self,robot)`, you can define whether you want to log your navigation data or not. If logging == True, your logging file will be in "log" folder. The file name should be date_time.csv.
2. In `__init__(self,robot)`, define the name of parameters you want to log, and call function: (note the input is a list in [], each element should be of string type.)
3. To log a variable, in track_point(self), call function: (note the input is a list in [], each element should be of float type.)
4. Every time when you restart the main dialogue window, your data will be logged in another file in 'log' folder
5. You may use MS Excel, LibreOffice Calc, Google sheet, or MATLAB to read the saved log file. You can plot whatever you want using these tools!
1. Modify track point file to achieve P control for point tracking
2. Feel free to define more functions and use more classes
3. It is not recommended to modify other .py files; because updates may be provided on these files
4. There are a few hints and reminders:
Firstly, your current position (including theta) and destination position are in global frame, you need to find \rho, \alpha, \beta through these positions
Assume kp, ka, and kb, make sure they follow the convergence criteria
Try different kp, ka, and kb, does the robot behave the same?
Can we let the robot go backward?
Figure 1. Main dialogue window, use slider bars to control robot simulation