Blog 13 – Moving Targets Inc.


11.11.2024 – 17.11.2024

You never fail until you stop trying.

-Albert Einstein

Group Summary

Dearly beloved,

we are getting ever closer to finishing the project. The remaining work is mainly for data and electronics, the mechanical engineers has finished most of their work on construction. The computer engineers now face the dreaded task of combining the code into one singular program, which probably, definitely, will not go smoothly. In order to test the code properly, we first need everything to be set up on the electrical part, which is Vetle’s job.

Individual Summaries

Eirik (Data):

Monday:

I finally got to test my code with the servos equipped, and surprisingly it ran relatively smooth. There were some minor issues that needs to be resolved; even though a person is standing completely motionless, the tilt and pan variables were still changing in small increments, like jumping between a value of 110 to 112 and back. This is not a problem in terms of the liability of the system, however it does result in the servos constantly moving back and forth to calibrate according to the variable values. Vetle suggests that some modifications with the servo pins (https://gpiozero.readthedocs.io/en/stable/api_pins.html#changing-pin-factory) may help reduce jitter, so that they become more precise and keep the servos at a standstill when there is no movement. If this does not fix the problem, I can probably just modify the code with an if-statement that says the servo should not respond if the variable has minimal variations, since it will not affect the shoot back system to a larger degree.

I also tried to implement the tracking system so that the HOG descriptor only locks on to one person until said person leaves the frame or the program is shut down. However, this did not go well, like, at all. Now I have problems with global and local variables, so the code does not run properly, meaning that I have a solid dose of debugging ahead of me. Lastly, I also got around to adding the code to our GitHub repository, though there were some technical issues with pushing since I have not really utilized GitHub to an extent before.

Tuesday:

So, the main problem with my code appears right here, on the bottom line:

When running the code, VS gives me the message “tracker cannot be accessed where it is not associated with a value. After searching through my code for what seemed like forever, I found one fault that may be a reason for why it will not run properly. And it is the smallest error I could have possibly made. The line

 “tracker = cv2.TrackerCRST_create()” has a grammatical error. The tracker function I am using is called CSRT, not CRST. This minor mistake was not the sole reason for the problems though.

The rest of the week has been dedicated to working with real-time systems and cybersecurity.

Robin (Data):

Fredrik and I have been working together this week to create the finished product that we hopefully soon can test on our entire system. Fredrik had previously been working with Tkinter user interface library to create a simple but effective experience. We also changed the code to be object-oriented programming to make threading easier, however it was a challenge to learn how classes works in python, as I had never done that before.
For now, we have created 3 different modes of playing which include:

  • Normal mode, gathering positions from 2 predefined arrays
  • Random mode, creating new random positions after each position
  • Debug mode, by using a text field in the UI, we can manually enter positions

2 points for me!

From the terminal output, theoretically, the stepper-motor should correctly move to the right position, however we’ll see when we can test it on the actual system.

We plan to use the Debug mode to find the system boundaries as soon as we can run our code on our system and perhaps create a fun pattern we can implement into the normal game mode.

Fredrik (Data):

This week I looked over the code Robin had made and tried to understand it which was easy enough because of helping text and well named functions. I then looked after what I could tweak or add to it. So, I tweaked it a tiny bit so the update score function worked as a thread by adding a while loop. Then made it so the game and point counter stopped when the clock reached 00:00. And did tiny work towards making a game finished function, hoping to make a nice screen with the points and if possible, a highscore.

Vetle (Electrical):

I have been testing out the IR receiver and IR emitter diode. I got the receiver to work after some trial and error using the IRremoteESP8266 library. For the target I will be using a TSOP4840 IR receiver and an Adafruit ESP32-S3 Feather microcontroller with a battery. It can then be connected to the RPi using Bluetooth. It only needs to se

Kadir (Mechanical):

This week I had exam, so start of week went to practice for that, it was also good training for our last stint of Fem analyses in this project.
Me and Hans had some discussions about final design of the model, agreed on new base and bardooning .
Test drew the shoot back system, if possible, video supplied.

Hans (Mechanical):

This week I have prioritized making the final touches to the main system mechanically.
I recut the base.
And painted it with outdoor varnish.

Drilled the required holes. And put it together.

Mounted the new baseframe on our model.
Also changed out the bardunes to chainlink, which make it easier to regulate the tension.


Leave a Reply