Tuesday May 2 Noon-2pm
Location: Engineering Design Center, 750 N Park Avenue, Tucson, AZ
Live Streams at: https://www.youtube.com/@ursutzinger/live
1st Place: Dalton and Trinity
2nd Place: A.J. and Jackson
3rd Place: Ryan and Sean
Your program needs to be at a know location and all the other modules it calls need to be in the same folder. meArm.py, kinematics.py, grip.py etc.
Your program can not have graphical OUTPUT or keyboard input.
You need to create service.
Make sure your program runs.
You need to enable the service.
cd /home/pi/myfolder/
ls myprogam.py
You can change your code in two ways: a) where ever you have imshow you add code as shown below. where ever you have waitKey or keyboard input you have code as shown below. b) you comment out those sections.
DISPLAY = False
if DISPLAY:
cv2.imshow("Camera", img)
if DISPLAY:
try:
k = cv2.waitKey(1) & 0xFF
if (k == ord('q')) or (cv2.getWindowProperty("Camera", 0) < 0):
stop = True
except: stop = True
cd /lib/systemd/system/
sudo nano my.service
The content of my services needs to be: MAKE SURE YOU USE Restart=always
[Unit]
Description=Hello Ballers
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/python /home/pi/2023/myforeverpython.py
Restart=always
[Install]
WantedBy=multi-user.target
This comman needs to be able to run in your shell without error. First go to a directory where your code is NOT located. Then run it.
cd /home/pi
/usr/bin/python /home/pi/2023/myforeverpython.py
The very first line of your python program needs to be:
#!/usr/bin/python3
Then in shell you enable service
sudo chmod 644 /lib/systemd/system/my.service
chmod +x /home/pi/myprogram.py
sudo systemctl daemon-reload
sudo systemctl enable my.service
sudo systemctl start my.service
This is a team project. While your team performance playing the game does not related to your grade, your team will need to demo throwing a ball for each robot and defending against a ball. Your team will need to write engineering documentation for each of the parts built and you will be graded as a team. Grading policy about equal contributions to your team applies.
We will work in teams for the remainder of the semester (see above). In order to be competitive, every team member will need to have a working robot consisting of
Camera
meArm
Raspberry Pi with motor hat
One Game Pieces (ball)
The Game Objective is to score balls in the opponents goal area. Your team forms an alliance of up to 3 players which defends against an alliance of up to 3 opponents. You will be using your meArm to handle a ball. Each round starts with placing a ball at a predefined starting location. You will attempt throwing that ball through the opponents goal. The ball will be placed by the referee sequentially on each players pickup location. We restart a game round each time a ball was scored, repelled or reached out of bounds. If the ball was out of bounds or repelled, the opponent's team will receive ball possession. You will want to defend against balls by placing the end of the arm in the ball's path. The goal is an area starting 50mm above the game surface and ending 100mm above it. All team members must be able to throw the ball. You can use your camera to identify the location of the ball and adjust your defending position. Your robot will need to throw after you push a button. You can defend against the opponent's ball by either positioning your arm at a static location or by adjusting the position automatically. You will want to enable defending or throwing mode with a switch.
Your player is your meArm. It will be controlled by your Raspberry Pi and your software will need to have a throw and defend sequence. For optimal defense you will want a ball tracker and move your meArm to an appropriate position. You can decide not to have an active defense program and park your arm at predefined position. For throwing, the player will need to start off at the ball pickup location. If you are the throwing robot, you will need to wait for throwing until the opposing team declares themselves ready.
Each player uses their own raspberry pi, meArm and software. You shall not stack multiple motor controllers onto a single pi.
The game field consists of two sheets, one representing the setup of your robots and the other the opponents setup. The two sheets will attach on the side forming a complete game field.
Each sheet shall have a goal which is an opening in vertical wall starting 50mm above the surface and ending 100mm above the surface. The height of the blocking goal surface shall not exceed 120mm, You can only manipulate the ball up to your goal surface. A successful throw passes the ball past your own goal line without any parts of your robot reaching past your goal line. The goal line extends from the surface of your playfield to infinite height.
To score a goal, the ball will need to pass the opponents goal area (green rectangle).
Each alliance will need to create half of the game field using the course supplied particle board.
If your team has less than 3 players, the goal size will be reduced and the reduced part will become an out of bounds line.
The game piece is a spherical ball of white color. The ball can not exceed 20 mm diameter. You shall fabricate the ball by 3D printing two halfs and glueing them together. Each player will need to bring one ball.
The claw of the robot can be replaced with a flat as long as that flat is not longer than 80 mm and wider than 40 mm. The flat can have a hole to hold the ball or other parts can be attached to hold the ball. The surface designed to defend against a ball can not exceed the flat width and can not be taller than 30 mm. The surface to defend a ball does not need to be flat. If a ball lands on the top of the flat or the defending surface, the ball is repelled even it bounces off past the opponent's goal area. If the ball lands on the edge of the flat or defending surface, the ball is not repelled.
The game piece handler and defending surface can be attached to the arm instead of the gripping fingers and wheels.
In order to identify the location of the ball a camera can be used. Both USB as well as small camera can be used. It shall not be located outside your own game area.
It is possible to run a ball tracker on a single Raspberry Pi and share the computed location for example with a camera pointing down to the center of the field. This can be accomplished with zeroMQ messaging. Your team will need to decided if each member uses a camera to track the ball or if a single camera is used.
To develop a computer vision pipeline the software tool GRIP is recommended as it uses opencv and can create python code. GRIP will be explained in class and documentation is here https://docs.wpilib.org/en/stable/docs/software/vision-processing/grip/introduction-to-grip.html
ball is successfully thrown when it passes your goal line: 1 point (successful kickoff). It does not need to pass your own goal area.
ball passes the out of bounds line: no point and round stops (round stop) and ball possession remains with player unless player already scored two times.
the ball passes the opponents goal area: 2 points and round stops (goooooal) and ball possession remains with player unless player already scored two times.
player is not able to kickoff the ball: opponents gain 1 points (forfeit) and ball possession goes to defending team.
ball is successfully repelled: 1 point (successful defense) and ball possession goes to defending team.
when ball possession changes, the referee selects player.
We will play on 4 desks. One setup will be played at a time while the other tables will serve to setup.
Setup should be completed within 5 minutes.
A round will last 60 seconds and is judged by the referees.
We will attempt a turn around of 1:30 minutes.
A coin toss selects the kick off team.
The selected player will engage the kick off position of the robot.
The referee will place the ball onto the players ball handler.
The opposing alliance will engage the defense mode.
When the opposing alliance declares themselves ready, the kick off player can engage the throw.
If the ball goes out of bounds, the other team will receive the ball.
When a team scores it remains with that team for kick off to a maximum of 2 throws.
The referee will alternate between each player for kick off.
Simple Program for RasPi with PiCamera2 the newer camera interface. This only works with the camera using flat ribbon cable, not USB cameras.
You need to install the picamera2 drivers: sudo apt install -y python3-picamera2
Also you need to disable the legacy camera support in the raspberry pi interface configuration: sudo raspi-config
If your camera is not found, you can get some help by running libcamera-still -o test.jpg
ZMQ is a messaging protocol with very low latency
pip3 install zmq
Please use the posted outline of the final report below as a guideline for writing. The Google Form to submit the final report is now available and linked below the outline.