We will play on two desks. One will be setup desk and on the other we will play the game.
Setup should be completed within 1 minute.
A round will last 60 seconds and is judged by the referees.
We will attempt a turn around of 1:30 minutes.
The left team starts with kick off.
Once the ball leaves the field the referee will place the ball back onto the field.
When the ball goes out of bounds it is placed on the other teams kick off locations.
When the team scores it remains with the team for kick off.
The referee will alternate between each player for kick off.
If the ball does not pass the middle line and does not go out of bounds the other team will receive the ball.
ball is successfully kicked and passes the middle of the game field: 1 point (successful kickoff)
the ball passes the out of bounds line: no point and round stops. (round stop)
the ball passes the goal line: 2 points and round stops. (goooooal)
player is not able to kickoff the ball: opponents gain 2 points. (forfeit)
the ball is successfully repelled and does not pass your own goal line: 1 points (successful defense)
the ball is manipulated with a part of the robot that is located behind the touch area: -1 point and round stops, except if the touching robot is no longer participating in the game due to software or mechanical failure. (foul)
The Game Objective is to score balls in the opponents goal area. Your team forms an alliance of up to 3 players defends against an alliance of up to 3 opponents. You will be using your meArm to handle the ball. Each round starts with placing a ball at a pre defined starting location, pushing that ball towards the opponents goal line. If the ball is repelled, one will need to defend against rebounds until the ball passed the game field boundary or a goal is scored or the ball comes to a stop. The boundary is your own goal line, the opponents goal line or the field boundary. The ball must be kicked off by all team members an equal amount of times. You can use your camera to identify the location of the ball. Your robot will need to play autonomously.
This is a team project. While your team performance playing the game does not related to your grade, your team will need to demo kickoff for each robot, 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 existing teams for the remainder of the semester. 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 or two Game Pieces (ball)
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.
Your player is your meArm. It will be controlled by your Raspberry Pi and your software will need to have a kickoff sequence. For optimal defense you will want a ball tracker and move your meArm to an appropriate position. You can disable your defense program and park your arm at predefined position.
It is desired that each player uses their own raspberry pi and your team does not stack multiple motor controllers onto a single pi. If you decide to use one raspberry pi your should be able to state the advantage to do so.
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 has a goal line, an out of bound line and a maximum reach line. You can only manipulate the ball in between the goal line, the maximum reach line and the out of bound line. When the ball touches the goal line your team scores. The ball does not need to be in contact with the game field in order to score. To score, the ball can not be more than 75mm above ground when it "touches" the goal line.
Each alliance will need to create half of the game field using the course supplied particle board.
The field will need to be flat and not allow the game piece to start rolling due to gravity.
If your team has less than 3 players, the goal line of either the top or bottom player will become an out of bounds line.
The game piece is a spherical ball of either yellow or blue color. The ball can not exceed 1.5 inches diameter. The weight of the ball will need to be more than 5 grams (this eliminates the option of using a painted ping pong ball). The color of the ball will be randomly assigned to the alliance. The alliance kicking off will chose the ball that will be played. Each alliance can use a different ball design as long as they meet the physical and color requirements. Yellow color matches the yellow PLA printer filament and blue the blue filament. If you create your game piece of other materials, yellow will need to be in HSV color-space H: 40-70 and blue H200-260 with H max = 360 and H min = 0. S and V should both be larger than 50 on a scale of 0...100 under regular room light condition.
The claw of the robot can hold a custom designed piece to manipulate the ball. The surface designed to touch the ball can not be wider, deeper or taller than 35 mm. The surface to touch the ball does not need to be flat but shall not extend outside the manipulation area between maximum reach line, goal line and out of bounds line at any time of the game. The touch area is on the front of the surface away from the robot. Any part of towards the back of the surface shall not touch the ball.
If you modify the claw, you can only remove the fingers and gears, not the motor and plate. You can attach the game piece handler to the plate.
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 protrude into the virtual volume encompassed by the game field boundary and 2 inches above the play field. The area above the robot boundary and the 100x100mm area in front of the robot belongs to the player and no other player shall place a camera there. If the player decides to place the camera outside the protected area, it shall not interfere with an other camera and flip of coin will decide on disputes. If the flip of coin decides against one player, that player will need to reposition the camera.
It is possible to run the 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 Network Tables or 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 kicked and passes the middle of the game field: 1 point (successful kickoff)
the ball passes the out of bounds line: no point and round stops. (round stop)
the ball passes the goal line: 2 points and round stops. (goooooal)
player is not able to kickoff the ball: opponents gain 2 points. (forfeit)
the ball is successfully repelled and does not pass your own goal line: 1 points (successful defense)
the ball is manipulated with a part of the robot that is located behind the touch area: -1 point and round stops, except if the touching robot is no longer participating in the game due to software or mechanical failure. (foul)
See here: Raspi Camera
ZMQ is a messaging protocol with very low latency
pip3 install zmq
https://zeromq.org/languages/python/
The program that runs the ball detection
import time
import zmq # isntall with sudo pip3 install pyzmq
import pickle
# ZMQ
# ---
port = 5555
class Point(object):
def __init__(self, x=0., y=0.):
self.x = x
self.y = y
ball_loc = Point()
# Open ZMQ
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://*:%s" % port)
# Main Loop
while True:
# Here go your ball detection routines
# Post zmq message if location request received
try:
message = socket.recv_string(flags=zmq.NOBLOCK)
if message == "loc":
ball_loc.x = -1
ball_loc.y = -1
if (len(outputy) > 0):
object = outputy[0] # take first object
ball_loc.x= object[0]
ball_loc.y= object[1]
if (len(outputb) > 0):
object = outputb[0] # take first object
ball_loc.x= object[0]
ball_loc.y= object[1]
p = pickle.dumps(ball_loc) # serialize the ball_loc object
socket.send(p)
except zmq.Again as e:
# print("No request received")
pass
The program that runs the meArm
import zmq
import time
import pickle
port = 5555
class Point(object):
def __init__(self, x=0., y=0.):
self.x = x
self.y = y
# Allocate the location object
ball_loc = Point()
# Socket to talk to server
context = zmq.Context()
print("Connecting to server…")
socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:{:d}".format(port)) # localhost is your computer
while True:
socket.send_string("loc")
# Get the reply
p = socket.recv()
ball_loc = pickle.loads(p) # deserialize the ball_loc object
print("Location x:{}, y:{}".format(ball_loc.x, ball_loc.y))
time.sleep(0.1)
# Here goes your meArm stuff
# ball_loc.x
# ball_loc.y
You need to open two shells for each of the two programs. They will communicate internally using ZMQ.