This week I mainly worked with Xiao to do the testing. My main focus is on latency. Previously the testing method is inserting time.time() before sending and after receiving the request and find the time difference divided by 2. However, this method seems to have some flaws since it isn’t necessary that send and receive times are equal. Therefore, we again used the slow motion camera to measure the time the button is pressed and the time input changes on the screen. The result hovers around 116-125ms which is around 6 times worse than our design requirement of 20ms. A few improvements we later discussed can be reducing the response message length to minimum and removing all the prints on the screen. We also make sure that the latency should be tested at different distances.
Next week, we will refine our testing and start working on the poster and final report. I will also try to invite 3 users to test our product.
Team Status Report for 04/22/2023
This week we’ve been integrating hardware, gyro algorithm, and software pieces together into a runnable game controller. Xiao has 3D printed a steering wheel case that encloses all the hardware components and wirings of the controller. Qiaoan has been working on the gyro tuning and refining the algorithm. There were some subtle bugs in our implementation of the Magwick algorithm which Qiaoan fixed this week. Yuxuan has been working on the lagging game data issue and was able to fix it by writing the data first into a file and reading them separately.
So far, we have a running mobile steering controller that controls the car via Bluetooth when buttons are pressed and when the steering wheels are rotated. The short demo video can be found at https://www.youtube.com/watch?v=I0n3i1ka-VY.
Since we are still working on our final presentation so we haven’t done any quantitative tests yet, but the details of the test procedure will be included in the presentation. Next week’s focus will be following the test procedure and gathering quantitative test results. We also need to start working on the final report early to ensure its quality.
Yuxuan’s Status Report for 04/22/2023
This week I’ve been focusing on solving the lagging game data that I encountered last week when I was trying to let PC send car outgauge data to the dashboard connected to the Pi. I fixed the issue by separating the data reading and writing logic on PC side. There is a program that specifically writes game data to a file without blocking. Then, there is another program that reads the data continuously from the file and then sends them back to the Pi.
In addition, I updated the readme file on the github repo that includes the workflows for running the dashboard programs. Though I haven’t gathered quantitative data, from my personal experience in testing, the dashboard on Pi reacts much more quickly to speed changes in the game than last week.
As shown on the screenshot, when the speed is at 39 km/h, the needle on the dashboard is also pointing at a bit under 40.
Next week, I will work with other team members to debug the system and implement codes for testing.
Team Status Report for 04/08/2023
This week we’ve been working on the remaining features of our mobile controller after the interim demo. We discussed our remaining tasks to focus on and updated the Gantt chart.
On the hardware part, Xiao has been working on modeling a new case that can fit existing electronic components into it. On the gyroscope system side, Qiaoan has been making efforts to implement and test the Madgwick filter to make the readings more accurate. On the rest of the software part, Yuxuan has been working on integrating the dashboard GUI onto the display connected to our RPi controller.
Next week we are going to continue working on these pieces which we are going to put together the week before the final presentation. We need also need to discuss the testing and validation requirements for the final presentation.
Yuxuan’s Status Report for 04/08/2023
This week I’ve been focusing on reading the data from the game and updating the data on display. So far, I’ve been successful in reading car data such as speed and rpm from the game through it’s outgauge protocol. On the display side, I’ve found a car dashboard template implemented in HTML, CSS, and Javascript that changes once keys are pressed. I’m working on integrating the template into our own project such that when car data is received from the PC on Pi, a JS function will be triggered to refresh the dashboard page.
I’m currently on schedule as now my focus will be adjusting the GUI for the display on the controller. Next week I will continue to work on the integration and test the display effects on the second screen we bought last week.
Team Status Report for 03/25/2023
Last week all the team members are continue designing and implementing both hardware and software. Our team members also gathered together to discuss what we have learned from the ethics assignment and considered worst-case scenarios when our product is used badly.
The hardware system part has made progress in wiring and is expected to be finalized by this weekend. The gyroscope system has generated the design on processing raw data from angular velocity and accelerations to degree output. For now the workflow of geroscope system is finished with design part, the next step will be start testing once the hardware system is ready. The program on RPi works well for now but there are still some issues with the packages on the PC that needs to be resolved. We are all working on our pieces so a reasonable prototype can be put on during the interim demo.
Our team is still a bit behind schedule as the interim demo is approaching. We need to have more meetings next week to synchronize our progress and discuss in what way we should present our progress during the interim demo.
Yuxuan’s Status Report for 03/25/2023
This week I’ve successfully installed and tested the Bluetooth module on Raspberry Pi. It’s able to act as a Bluetooth client or a server. However, I’m still struggling to get the Bluetooth module to work on windows PC. The program will have OS errors only when calling certain functions. I’ve spent a significant amount of time following the solutions online, including installing Windows 10 SDK and installing build tools from Visual Studio to compile C++ code, but the error still exists for now. Some progress is made when testing with the controller emulator as the Xbox tester program can accurately detect the emulator’s input from the tester program as shown below.
https://drive.google.com/file/d/1a4xpNfXjKo9RPMEPMMTBzyBwYentaU0O/view?usp=share_link (Couldn’t upload images for some reason)
Next week, the primary focus will still be making sure the Bluetooth connection can be established. I’ve just found another solution that simply uses the socket library with Python 3.9+ on Windows 10 to establish a Bluetooth connection. There are only a few discussions about it online but still worth a try. The next step will be talking with Xiao and Qiaoan so we can agree on the data format to be sent between RPi and PC. My initial plan is to use json. I’m still a little behind the schedule due to the problems with bluetooth package on PC. I will catch up as much as possible to make sure the Pi can control the game on PC before interim demo.
Yuxuan’s Status Report for 03/18/2023
This week I spent some time reading the ethics papers and finishing the ethics assignments. I received the Windows PC this weekend and was trying to run the demo programs using the packages specified in the design. I also ordered a second RPi for pure sensor and software testing purposes. The PC also matched the minimum requirement to power up the game. I’m a bit behind the schedule this week as projects in other classes due this week took an unexpected amount of time. For next week, I will spend more time catching up on running and developing the programs based on the demo program on PC so that it can establish the Bluetooth connection and read data from the game.
Yuxuan’s Status Report for 03/11/2023
This week I’ve been mostly working on creating a demo on Bluetooth communication and writing part of the design review document. The package initially used for Bluetooth communication is Pybluez. However, the package is not stable on Mac OS. I tried to install and import the bluetooth package and it already says it’s missing other packages. After installing the missing packages, it then says it cannot find the method inside the package. I’ve looked at many issue threads related to it on the repo and still cannot fix the bug. I believe that the code is importing packages that have conflicting versions that require manual fixes on the code after installation. I’ve also tried a well-maintained package called Bleak but it’s mostly acting as a Bluetooth client and it provides little documentation for creating a Bluetooth server.
An alternative way to establish communication between two devices is using a TCP connection via a socket. I’ve tested the round-trip communication time between Mac running as an echo server and iPhone running as client but the result is not optimal. Sometimes the round trip time is more than 200ms which won’t meet our design requirements. The TCP solution and USB serial connection should be put as our backup plan in case the Bluetooth connection solution fails.
The work is mostly on schedule. I’m going to focus on installing the Bluetooth packages on a Windows PC once it’s available next week. Once the Windows PC is received, I will also try to test the Xbox emulator package and codes that read data from the game. If all the packages can be successfully installed and tested, the latter implementation for the game controller can be much smoother.
Yuxuan’s Weekly Status Report for 02/25/2023
This week I’m mostly looking into the details of how the program on the PC side can simultaneously handle data from the Pi client via Bluetooth and interact with the game. I’ve thought about using multithreading as I read into the tutorial, but I realized that multithreading is unnecessary since we only have one client and one server, so only a single connection is needed. A feasible way of implementing the program is by binding a socket to a port where the program can read game data. In addition, another socket will be created and bind another port for Bluetooth communication. Then, all the communication and actions can be done in a while loop. The initial file structure is created and some skeleton codes on the PC side are pushed to this repository on GitHub.
One block I realize is that the PYXinput Xbox emulator is used for windows only but I’m using a Mac for development. Also, only a powerful game laptop can power the BeamNG game for further testing. Therefore, I need to look for a way to borrow a game laptop next week.
The progress is mostly on schedule. The priority for next week is obtaining a gaming laptop. Both of my teammates use Windows and are pro gamers so I will ask them about this issue. Meanwhile, I’m planning to implement the program mentioned above on the PC side.
To fill in the gap for team members, I can talk with Xiao about the exact functionalities of the buttons and hardware so we can have a better understanding of what signals will be read and interpreted by the program. I can also talk with Qiaoan and assist him with tuning the gyro sensor by writing program that reads the outputs.