In this Design Exercise, you will use the IMU's accelerometer to launch the ball created in the ball game from Exercise 02. By moving the embedded system, you will impart the initial trajectory on the ball. Kind of like for the Wii:
Instead of hard-coding the initial trajectory of the ball (or making it random like in ex02), we will use trajectory of the system. Starting with a single ball somewhere on the screen (it's up to you to decide where it goes), when you want to start, you push and hold the button down. You then move the embedded system in a certain direction at a certain velocity/acceleration and when you release the button the ball should start moving in that direction based on your velocity at release.
This will be much easier to implement if you keep the embedded system flat on a desk or table and just move it in a 2-D plane. If you want to try it in 3-D space so much the better, but realize it is MUCH harder both from an IMU-processing perspective and from how you'd even go about visualizing the effect of that in the low-resolution 1.8" screen of our LCD.
Your ball should bounce of the walls and incorporate viscous friction and lossy reflections off of walls, like we did in Exercise 02 (basically you don't need to change it from what you got working). It's up to you to figure out what parameters to record during the initial motion (position, velocity, acceleration? all three? just the end values? average values?) so that a realistic motion occurs, but you'll need to succintly explain that in your design exercise description below.
While the ball is bouncing around, if you press and hold the button again, a second ball should appear on the screen and you can repeat the process, now with two balls moving around (the first ball keeps going on as it was, and the second ball follows the latest trajectory). Don't worry about implementing collisions. You should be able to do this for up to four balls. You can stop at four balls, or you can keep going. It is up to you.
How you implement more than one ball simultaneously is up to you. Consider modifying our Ball-related functions to use pointers in a way similar to how the scrolling text functionality was fixed when we transtioned to three simultaneous scrollers in the supporting code from Lecture 01, and then using more globals (or arrays of global variables) to hold the system states (position, velocity) of multiple balls.
You should implement a way to reset the game, i.e., remove all the balls and start over...Without unplugging or resetting the entire system, that is. Your system can have at most two pushbutton switches on it.
When your system is ready, create a short video of it working and displaying the different behaviors above, and a copy of your ESP32 code.
You can upload your video to Youtube or any other site that is accessible by the staff.
Error on line 2 of python tag (line 48 of file /S19/ex03/ball_launch): kerberos = cs_user_info['username'] KeyError: 'username'
Submit all of your code below in one file:
\ / /\__/\ \__=( o_O )= (__________) |_ |_ |_ |_Course Site powered by CAT-SOOP 14.0.4.dev5.