-
Notifications
You must be signed in to change notification settings - Fork 0
/
lab8.html
66 lines (65 loc) · 5.68 KB
/
lab8.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Lab 8</title>
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="css/styles.css" rel="stylesheet" />
</head>
<body id="page-top">
<!-- Navigation-->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top" id="mainNav">
<div class="container px-4">
<a class="navbar-brand" href="#page-top">Jin Hyun's ECE 4160 Website</a>
<div class="collapse navbar-collapse" id="navbarResponsive">
</div>
</div>
</nav>
<!-- Header-->
<header class="bg-primary bg-gradient text-white">
<div class="container px-4 text-center">
<h1 class="fw-bolder">Lab 8: Stunts</h1>
<p class="lead">The objective of this lab is to combine everything I've done up till now to do fast stunts.</p>
<a href="index.html" style="font-size: 20px;color: white;text-decoration: underline">Back to mainpage</a>
</div>
</header>
<!-- About section-->
<section id="about">
<div class="container px-4">
<div class="row gx-4 justify-content-center">
<div class="col-lg-10">
<h2>Introduction</h2>
<p>For this lab, I made my robot drive towards the wall as fast as it can and when was within 3 feet of the wall, perform a 180 degree drift and come back to the start line.<p>
<h2>Orientation Control</h2>
<p>First off, since I chose to do position control for lab 6, I had to write new code for orientation control for this lab. I used code from lab 4 to compute the yaw angle of the robot. Then I implemented a proportional controller to control the robot's orientation (i.e. yaw). Here is the code I wrote to achieve this:<p>
<script src="https://gist.github.com/apark2459/7a8046fe0665118a243c7848096975d1.js"></script>
<p>Here is a video of the orientation control working:<p>
<iframe width="640" height="360" src="https://youtube.com/embed/0GX7j2DWIPk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<p>Below is the plot of the time vs. orientation (yaw) from the video above:<p>
<img class="img-fluid rounded mb-5" width="460" height="315" src="assets/img/lab 8/plot.png" alt="...">
<h2>Performing the Stunt</h2>
<p>My plan for the stunt was to simply use the code I wrote for the orientation control but add in an offset to the PWM values by a value of 100 so that the robot moves forward with 100 PWM while maintaining control of its orientation. Then when it got to 300 mm from the wall, it would perform a 180 degree turn and return to its initial starting position while maintaining its original orientation using orientation control. Unfortunately, getting the robot to do a stunt using the orientation control developed in the previous section proved to be a real challenge. One of the biggest problems I had was that if the angular velocity of the robot changes too fast, the zero point of the robot's orientation changes. This is likely due to the fact that the angular velocity was changing quicker than the control loop could run (i.e. the code could not integrate the angular velocity quick enough to accurately capture the robot's orientation). Therefore, I had to use open-loop control to perform the stunt. The code for the open-loop control is below:<p>
<script src="https://gist.github.com/apark2459/6dee085da922639d640f4faa8d3c22da.js"></script>
<p>Here are videos of 3 successful runs of the stunt:<p>
<iframe width="640" height="360" src="https://youtube.com/embed/2axTWdyuU2w" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<iframe width="640" height="360" src="https://youtube.com/embed/bQjhn1gBNNo" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<iframe width="640" height="360" src="https://youtube.com/embed/8TSlDvy64I0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<p>If time allows at the end of the semester, I plan to implement the extrapolation method from lab 7 such that the robot can react faster to sensor measurements.<p>
</div>
</div>
</div>
</section>
<!-- Footer-->
<footer class="py-5 bg-dark">
<div class="container px-4"><p class="m-0 text-center text-white">Copyright © apark2459.github.io 2023</p></div>
</footer>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="js/scripts.js"></script>
</body>
</html>