Skip to content
Snippets Groups Projects
Commit 46ce8708 authored by Jeff Chang's avatar Jeff Chang
Browse files

pushing last notebook update

parent 164b33b2
Branches develop
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -535,3 +535,42 @@ if(a1[0]>=220){ ...@@ -535,3 +535,42 @@ if(a1[0]>=220){
continue; continue;
} }
``` ```
## Dec 2nd, 2021 (Acceleration, Backup Code, Verification)
### Acceleration
We added a final section to strengthen the end-of-movement detection algorithm. This code basically book keeps which direction we are going, and doesn't allow velocity to go in the opposite direction in a certain period of time. Specifically, we use old_mouseX and old_mouseY to store the previous direction, and set the mouse direction to be zero when we see a jump of sign.
```
if ((mouse[4] > 0 && old_mouseX < 0) || (mouse[4] < 0 && old_mouseX > 0)) {
mouse[4] = 0;
}
else {
old_mouseX = mouse[4];
}
if ((mouse[5] > 0 && old_mouseY < 0) || (mouse[5] < 0 && old_mouseY > 0)) {
mouse[5] = 0;
}
else {
old_mouseY = mouse[5];
}
```
### Backup Code
In our testing, we realized it might be more stable to use components of gravitational acceleration for calculating position update. If we tilt our hand to the right, we will see the gravitational acceleration component in the y direction. Using these values, we can simply add a counter and continuously send position update in that position just like how we wrote the code for volume control. In the code below, you can see we set a threshold to see if the hand is tilted enough, then just continuously send a +5 or -5 position update to the PC using mouse[4] and mouse[5], until that tilt in the device goes below 50. Since our usual implementation is prone to hand instability, we plan on flashing this version during demo as well.
```
if(abs(a1[1])>=50) {
mouse[4] = 5*(a1[1]/abs(a1[1]));
}
else {
mouse[4] = 0;
}
if(abs(a1[0])>=50) {
mouse[5] = -5*(a1[0]/abs(a1[0]));
}
else {
mouse[5] = 0;
}
```
### Verification
After all the code implementation, I conducted the verification for most subsystems. All the data are collected in the file "data445.xlsx" and will be presented in the presentation, so I will not copy them here again. I took videos of all the testing and that information has been pushed under "[demo/demo_videos](https://gitlab.engr.illinois.edu/zy8/ece445-lab-notebook/-/tree/develop/demo/demo_video)"
# This marks the end of the project.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment