According to the PDF file taken from the official RoboCup website, we have to design the competition field dynamically, that is, we should not have any problem displaying it on any screen with any resolution.
install necessary libraries for python with these command :
-
for install opencv library
pip install opencv-python
-
for install numpy library
pip install numpy
Land ratios for KidSize Robot with Python programming language :
fieldLength = 9 * meter2Pixel
fieldWidth = 6 * meter2Pixel
goalDepth = 0.6 * meter2Pixel
goalWidth = 2.6 * meter2Pixel
goalHeight = 1.2 * meter2Pixel
goalAreaLength = 1 * meter2Pixel
goalAreaWidth = 3 * meter2Pixel
penaltyMarkDistance = 1.5 * meter2Pixel
centerCircleDiameter = 1.5 * meter2Pixel
borderStripWidth = 1 * meter2Pixel
penaltyAreaLength = 2 * meter2Pixel
penaltyAreaWidth = 5 * meter2Pixel
windowWidth = fieldWidth + 2 * borderStripWidth
windowLength = fieldLength + 2 * borderStripWidth
penaltyRadius = int(0.075 * meter2Pixel)
robotSize = int(0.27 * meter2Pixel)
radius = int(1.5 / 2 * meter2Pixel)
Land ratios for AdultSize Robot with Python programming language :
fieldLength = 14 * meter2Pixel
fieldWidth = 9 * meter2Pixel
goalDepth = 0.6 * meter2Pixel
goalWidth = 2.6 * meter2Pixel
goalHeight = 1.8 * meter2Pixel
goalAreaLength = 1 * meter2Pixel
goalAreaWidth = 4 * meter2Pixel
penaltyMarkDistance = 2.1 * meter2Pixel
centerCircleDiameter = 3 * meter2Pixel
borderStripWidth = 1 * meter2Pixel
penaltyAreaLength = 3 * meter2Pixel
penaltyAreaWidth = 6 * meter2Pixel
windowWidth = fieldWidth + 2 * borderStripWidth
windowLength = fieldLength + 2 * borderStripWidth
penaltyRadius = int(0.075 * meter2Pixel)
robotSize = int(0.27 * meter2Pixel)
radius = int(1.5 / 2 * meter2Pixel)
Source Code :
Ground = np.zeros((windowWidth, windowLength, 3), np.uint8)
Ground[:] = (0, 150, 0)
# Points corresponding to the quadrant of the Ground
pointA = (borderStripWidth, borderStripWidth)
pointB = (borderStripWidth + fieldLength, borderStripWidth)
pointC = (borderStripWidth + fieldLength, borderStripWidth + fieldWidth)
pointD = (borderStripWidth, borderStripWidth + fieldWidth)
cv2.line(Ground, pointA, pointD, (255, 255, 255), 2, 8, 0)
cv2.line(Ground, pointB, pointC, (255, 255, 255), 2, 8, 0)
cv2.line(Ground, pointC, pointD, (255, 255, 255), 2, 8, 0)
cv2.line(Ground, pointA, pointB, (255, 255, 255), 2, 8, 0)
#-----------------Middle Line---------------
pointMiddlelineA = (borderStripWidth + fieldLength//2, borderStripWidth)
pointMiddlelineB = (borderStripWidth + fieldLength//2, borderStripWidth + fieldWidth)
cv2.line(Ground, pointMiddlelineA, pointMiddlelineB, (255, 255, 255), 2, 8, 0)
The coordinates of each point for this section are as follows:
The coordinates of each point for this section are as follows:
The coordinates of each point for this section are as follows:
The coordinates of each point for this section are as follows:
The coordinates of each point for this section are as follows:
After all of that you should see something like this:
.:: Mohammad Reza Sheikh Ahmadi ::.
- OS: Windows 11
- Laptop: TUF Gaming
- Code Editor: Visual Studio Code - The best editor out there.
- To Stay Updated: Medium, Linkedin and Instagram.
βοΈ Checkout Our VSCode Configrations Here.
π If you like my projects, Give them β and Share it with friends!