Yuxuan’s Status Report for 04/29/2023

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.

Yuxuan’s Status Report for 04/01/2023

This week I’ve been focusing on integrating the Bluetooth connection module with the emulator mappings. RPi and laptop can now use Python via Bluetooth by sending JSON packets that encode the raw button input format. On the PC side, after receiving the packets, the program can decode the value and maps the keys in JSON to the emulator which presses or releases a button based on the values of the raw button input in the JSON packet.  I also updated the README on Github which details how to pair RPi to the laptop.

The next step for this weekend is to continue to work with my team members to integrate the hardware part, especially the button reading section into the program. Once the real button values are encoded in JSON packets and sent to laptop, we will have a full pipeline for 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 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.

 

Yuxuan’s Status Report for 02/18/2023

This week I’ve been designing software systems that allow Raspberry Pi and Windows PC to communicate game data. I’ve created a diagram as shown below showing how and what kind of data is flowed between different hardware and software as well as devices. 

The diagram uses blocks to identify major software components I need to implement in order to achieve communication between two devices. For each component, I identified certain libraries that can be used to accomplish the task in a document called Module Details in our shared folder on Google drive. It contains links to the library repo, discussions, and video demos.

I’m currently mostly on schedule as we are finalizing our designs this week.

Next week I’m planning to try implementing the process of retrieving data from the game using the Outgauge protocol as well as emulating the Xbox controller using the PYXInput library to establish a basic interaction with the game using codes.

The courses covered in this process are 18-213 and 18-349. Both involve creating software systems transmitting data from one device to the other via different protocols.

Yuxuan’s Status Report for 02/11/2023

This week I’ve been mostly exploring the software design ideas related to how the game should interact with the controllers. I looked into the API which is developed by the game BeamNG.drive on this repo. The examples and features are mostly related to setting up a car driving environment by using the library function calls to set up a simulator on a PC.  For example, the user can specify the car brand to be Honda and the location to be west coast by calling related APIs This is quite different from what we initially thought since we are designing a program that sends input data to a PC.

Then, the focus is shifted towards firmware on hardware that can read inputs from hardware and send the data to the PC. The game itself should interpret the control data sent by the controller.  I found this repo which is a firmware that can act as a game controller using Raspberry Pi Pico and send data via USB.  I’m planning to dive into code and explore their design ideas in order to gain a better idea of how hardware and game interact via firmware for my following research. Currently, I’m on schedule.