The Secrets of Robot Football Joerg C. Wolf Centre for Robotics and Intelligent Systems Joerg.wolf-a-t-plymouth.ac.uk University of Plymouth Drake Circus Plymouth PL4 8AA U.K. 1
Seminar: The Secrets of Robot Football Dr Joerg Wolf, http://www.swrtec.de Friday 14 Nov 2008, 1.30pm 2.30pm, Room SMB204 The University of Plymouth has a track record of developing robot football systems for the last 11 years. By reviewing this development we may be able to predict how future robotic football players will look like and how this will influence the future of robotics research. This seminar will show how robot football systems work in detail. How are these little robots detected by the camera? How do you control the robot s position? Over the years many spin-off student projects have been completed that have used robot football algorithms and circuits. There may be something useful in it for your project.
Topics Part 1: Robot Football Introduction Hardware Communication Vision System Strategy Introduction Robot Control Advanced Strategy Methods Mechanical Analysis System Tuning Research Fields
Robot Football What is Robot Football? fully Autonomous Robotic Players that play football Worldwide organizers of Robot Football Competitions: FIRA RoboCup FIRA Founder Professor Jong-Hwan Kim 4
Popular FIRA Leagues MiroSot Large League: 11 aside Middle League: 5 aside SimuroSot Simulation of MiroSot 5 aside HuroSot Humanoid Robots Onboard vision/control 5
Popular FIRA Leagues All FIRA leagues are played robots autonomously, there is no human remote control. The there is only a start and stop button for human intervention. MiroSot is played on MiroSot: A wooden pitch painted black. The 5 aside pitch is 1800x2200 mm. Each team positions a camera above the pitch that can recognize the robots through a vision system computer. The computer makes a decision on where to send the robots. This is passed to the robots via radio link. The robots are 7.5 cm cubed. It is allowed to put any hardware into the robots,camera or computer. They play with an orange golf ball.
Popular FIRA Leagues SimuroSot SimuroSot is a simulation of a MiroSot game. It is a league in its own right. The Strategy for the SimuroSot is an exchangeable software module ( DLL ). Every team writes a strategy module and lets it compete. The Simulator was written in Macromedia Studio.
Popular FIRA Leagues HurSot: HuroSot is a FIRA league that is played with humanoid robots. In the smallest category they are limited to 50cm height and must have all vision and processing onboard. The league has recently gained popularity. There are several challenges that the robot attempts to gain points in the HuroSot competition: Marathon, Penalty shootout, Basketball, Sprint, Obstacle Run, walk over uneven terrain and a 3 aside football match.
HuroSot 9
HuroSot Robots in Plymouth Prototype early 2007 San Francisco 2007 Zurich 2008 10
11
Robot Football What makes a robot intelligent? Intelligent information processing Sensors provide information for processing 12
Robot Football Sensors used in Robotics: Camera Infra-Red Distance Sensors Laser Range Finders Ultra Sonics ( Sonar) Simple switches Gyros 13
Robot Football: Comparing Robotic Intelligence RoboSapien Sensors: - switches Remote Controlled Robot Football Humanoid Sensors: -Camera -Gyroscopes, -Accelerometers -Force feedback Completely Autonomous 14
Robot Football System Overview MiroSot League Camera Image Processing Strategy Robot movement 15
16 Plymouth Robot Football 1995 Robot Football established in South Korea and Japan 1996 Mirosot'96 was held in KAIST, Korea. 1997 Mirosot'97 was held in KAIST, Korea. 1997 Robot Football established in Plymouth,U.K. by Dr Paul Robinson and Jeff Johnson 1998 University of Plymouth and the Open University jointly participate in the FIRA World Cup in Paris, France Further participations: 2002 FIRA Wold Cup 2002, in South Korea 2003 FIRA Wold Cup 2003 in Vienna, Austria 2003 Robot Football at the Weird world exhibition 2003 FIRA European Cup in Lublijana, Slovenia 2004 University of Plymouth becomes U.K. Champion 2004 FIRA WorldCup in Busan, South Korea 2004 FIRA European Championships in Munich, Germany 2005 FIRA WorldCup in Singapore 2005 FIRA European Championship in Twente, Nederland 2006 FIRA WorldCup in Dortmund, Germany 2007 FIRA WorldCup in San Francisco, USA 2008 FIRA WorldCup in Zurich, Switzerland / Linz, Austria Next: 2009 FIRA WorldCup in Incheon, South Korea
Plymouth Robot Football 17
Student Projects Research Open Days (Course Promotion) Competitions
Generations of Robots in Plymouth 1997 1998 2001 2004 2007
Specs Standard Competition Robot Made of a milled block of aluminium Size: 7.5 x 7.5 x 7.5 (cm) Weight: 450-650 g Power: 300mAh 1000mAh 7.4V LiIon pack Max Velocity: 2-3 m/s Motor: Faulhaber 2224 DC Motor Gear Ratio: 8:1 CPU: ATMEL ATMEGA for Control : PID, PWM ( some models have Intel IAR 296C or Intel 188) Communication: RF modules (418 & 433 MHz) Radiometrix RX/TX2, BIM2or ZigBee/XBee 2.4GHz Typically 19200bps or 38400bps
UoP Circuit Board 2007
UoP4 Radio Communication Protocol Packet send every frame containing the velocity left and right wheel...0x55 0x55 0x55 0xFF 0x72 [ CON1 CON2 ID1R ID1L ID2R ID2L ID3R ID3L... CRCH CRCL ] All robots listen to the same packet and take out their part 1 byte per velocity, therefore the range of the velocity is +/- 127 22
Radio Transmitter SkyNet 23
Modified Yujin YSR 1 st Generation: buy a Robot Soccer Kit 2 nd Generation: modify the Kit 3 rd Generation: design your own Yujin YSR Chassis with custom circuit board 24
Miabot Pro Research Robot
Bluetooth communication enables communication of a large swarm of robots. With the stackable bluetooth server hundreds of robots can be controlled at once.
Bluetooth Bandwidth: 1 MBit Packet delivery is guaranteed, no errors ( checksum in protocol stack ) Latency 39 ms, Std. Deviation 16 ms Pairing Bluetooth Server ( autoconnect ) Robot Football is Using the Serial Peripheral Protocol (SPP)
Robot Football Image Processing 28
Robot Football Image Processing 29
Robot Football Image Processing 30
31
Hue Arthur Hatt, "A Red/Green/Violet color wheel", The Colorist, 1908
Hue In order to identify the robots, one must identify the colour on the skirts (robot s top ). Colour identification is done by defining a range of colours that the robot has. This range of colours, for example Yellow+Lemon yellow is shown together in this Hue circle. In RGB (red, green, blue) colour space, which is a cube, this is not as easy to define. Furthermore, a colour space where it is easy to define a colour has intensity separated out. The most common colour spaces used are HIS (Hue,Saturation, Intensity) and YUV.
Image Source: Wikipedia Magenta ID Blue Team Vision Systems Hue Cyan ID Green ID Yellow Team Ball 34
RGB to HSI HSI = Hue, Saturation, Intensity θ = H cos 1 θ = 2π θ 1 2 (R - G) [(R - G) + (R - B) ] G 2 otherwise + (R - B) + (G - B) B S = 1 min( R, G, B) I = R + G 3 + B 35
RGB to HSI This formulae convert from Red-Green-Blue colour space to HSI colour space. The Hue Theta is the actual colour. The saturation S shows how deep the colour is. Saturation is not used in most robot football systems. Intensity I is the brightness. The formula shows that brightness is actually an average of R,G and B. The values R,G and B are defined between 0 and 1. H is adjusted to be between 0 to 2 pi.
RGB to HSI void RGB_To_HSI(unsigned char B, unsigned char G, unsigned char R, double &H, double &S, double &I){ double min_rgb; if(r && G && B){ I = ((R+G+B)/3)/255.0; // Calculate Intensity min_rgb = (R<=G)? R : G; min_rgb = (min_rgb<=b)? min_rgb : B; S = 1.0 - ( (3.0 * min_rgb) / (R+G+B) ) ; // Calculate Saturation double num = ((R-G) + (R-B))/2.0; double denum = pow((double)(r-g), (double)2) + (double)(r-b) * (double)(g-b); H = acos(num/sqrt(denum)); // Calculate Hue if(s == 0) H = 0.0; else if(h == 0){ if(b>g) H = M_PI_2; else H = 0.017; } //3rd and 4rd quadrant if( (B>G) ){ H = 2.0 * M_PI - H; } }else{ I = 0.0; S = 0.0; H = 0.0;} } 37
YUV Y = Intensity (luma) UV plane (chrominance): 38 Image Source: Wikipedia
Grey or Colour? If R,G and B have the same intensity, it is grey. Example: 128,128,128 Extremes: 0,0,0 (black) 255,255,255 (white) Difference between the three bool isgrey(unsigned char b,unsigned char g,unsigned char r){ if( (abs(r-g)<grey_thresh) && (abs(g-b)<grey_thresh) ) { return true; } else { return false; } } The formula to turn RGB into a Hue-value is only usefull if the pixel is really coloured.pixels that are black,grey,white or anywhere in between do not carry any colour information. The football pitch is painted black. The vision system can use the grey thresholding to determine if it found a coloured object or just scanning the pitch. Once a coloured pixel has been identified, further searching in the area can take place to determine the exact position and size of the object. 39
Vision Systems: White Balance Not balanced Balanced How to recognise: Grey is not Grey Colours appear not like in real Edges have fade through multiple colours Histogram of RGB: The Peak corresponds to the Grey pitch. 40
Vision Systems: White Balance The red, green and blue channel can be out of synchronization. In this case the hue-value is shifted and grey pixels suddenly are slightly coloured. In order to synchronize red, green and blue a camera has a an automatic white balance. Vision systems should not rely on automatic white balance, especially in robot football, where the dark pitch takes up most of the screen, the automatic white balance does not work very well. Manual white balance during setup is best.
Vision Systems: White Balance Picture show bad white balance Analogue signal between camera and digitizer card Sharp changes in intensity reveal white balance problems Low pass filter effect of signal path create black strips 42
Spherical aberration 43
Spherical aberration zoom = 0.95 ; correction_v = 0.00015 ; cx=xsize/2.0; cy=ysize/2.0; for (ycnt=0;ycnt<ysize;ycnt++){ for (xcnt=0;xcnt<xsize;xcnt++){ x=(double)xcnt-cx ; y=(double)ycnt-cy ; d=sqrt(x*x+y*y); nx=cx+x*(zoom+correction_v*d); ny=cy+y*(zoom+correction_v*d); if(nx<0)nx=0;if(nx> xsize )nx=xsize; if(ny<0)ny=0;if(ny> ysize )ny=ysize; *tablep = ( (int)nx +(int)ny * xsize ) * 3 ; } } 44
Spherical aberration Spherical aberration is caused by the shape of the lens near the edge that is not ideal. However, due to production techniques this is the most common type of lens. Zoom lenses usually have more aberration than fixed lenses. There is no aberration in the centre, and along the main axes. There are two problems problems caused by aberration in object recognition: 1.Objects appear smaller in corners (less pixels) and may therefore be missed 2.The coordinates of Objects are offset to the real world.
Spherical aberration The source code shown earlier corrects the whole image. There are two problems: 1. Black strips appear from the stretching 2. Computationally intensive Solution: After calibration, only correct the coordinates of the identified objects ( colour blobs ).
Vision Systems The human eye can deal with a wide range of intensity (brightness). A camera CCD only works with a very narrow range. In order to make it easier for the camera there must not be any variation in intensity across the field of view. Spot lights are bright, however they have a wide variation in brightness (easily 500 Lux). Therefore spotlights can not be used. Fluorescent lighting tubes are the best. A diffuser on them improves the even spreading of light further. Even Lighting is important 1000 Lux 47
Vision System at JUST 48
Vision Systems Hue Spectrum Examples: 4. too bright (e.g. >1200 Lux) Saturation prevents doing measurements. 3. bright (e.g. <1200 Lux) The spectrum is a thin peak. 2. normal conditions (e.g. <600 Lux) The spectrum shows a round hump. 1. too dark ( e.g. <200 Lux) Everything is grey (noise), all colours are detected equally. line around 20% 49
Vision Systems Camera : path of the light/information: Iris-> Shutter (exposure)-> CCD -> Gain -> Brightness 50
Vision Systems Image Processing: Must be very fast: 640x480 x 3Bytes x30 fps = 27.648 MByte/sec! Avoid Floating Point Calculations Avoid Convolution (kernel) based Filters Avoid Processing every Pixel Use Look up tables (e.g. RGB to HSI, aberration ) 51
Vision Systems Algorithms to find coloured Regions Blobs : Cross Scan Sampling the image in a rough grid. When a coloured pixel is found neighbouring pixels are scanned horizontally and vertically in a cross to measure the extent of the blob. With an estimate of the extent a new centre is found and another cross scan takes place. 52
Vision Systems Cross Scan: Scan horz. (find centre) Scan vert. (in the horz. middle) scan horz, (in the new vert. middle) done 53
Vision Systems Algorithms to find coloured Regions Blobs : Region Growing Sampling the image in a rough grid. When a coloured pixel is found a new region is defined. The neighbours and the neighbours of the neighbours are recursively investigated and added to the region. Pseudo Code Example: Check_Region(x,y,BlobID){ } if(! isgrey(x,y) ){ }else{ return; addpixel_to_blob(x,y,blobid); Check_Region(x+1,y,BlobID); Check_Region(x,y+1,BlobID); Check_Region(x-1,y,BlobID); Check_Region(x,y-1,BlobID); 54
Blob List Duplicate Elimination Check With, Height min and max Check distance between blobs to find robots 55
Vision System From Blobs to Robots: Blob Linking ID 1 ID 2 ID 3 Link Team colour with ID colour 56
Vision System Calibration The robots colour patches are small, typically between 6-15 pixel wide. This makes identification difficult, and the calibration process delicate. It takes up to 1 hour to calibrate a robot football vision system. ( be patient )
Simulator Thanks to: Jun Jo University of West Australia 58
Simulator Simulator is compatible with RSE Frame rate RSE: 30 fps, Simulator 60fps Data in: Position, Orientation of robots Data out: Motor commands: wheel velocity 59
Robot Football Strategy Overview Role Selection ( nearest to the ball? behind the ball? ) Individual Player State Engine ( move, stop, turn, wait ) Guidance System ( Trajectory following ) Low Level Control ( Wheel speeds, slip ) 60
Robot Football Strategy Role Selection Defender1 Goalkeeper Striker Defender2 Striker Assistant 61
Robot Football Strategy Role Selection Goalkeeper: Stay on the line, predict incoming ball go out only when there is no danger Defender Like goalkeeper, predict incoming ball and get in between ball and home side Kick the ball out of the area Clear the ball from corners Striker Get behind the ball in order to kick it towards the goal Assistant If Striker / Defender fails, the ball will pass to the assistant 62
Robot Football Player State Engine ball-goal line: Robot must approach from a direction in line with the ball and the goal. A circle movement is simple, with constant velocity on both wheels (one faster than the other) the robot drives in a circle. Everything is moving, robot and ball, therefore prediction must be used. Striker 63
Robot Football Strategy - Guidance System Line of Sight Guidance or Missile Guidance θ Target = atan2( Y, X ) Θ robot Δy Θ error Θ Target θ error = θ Target θ Robot Δx 64
Robot Football Robot Control The robots heading angle at an instant is in the same direction as its velocity vector V V V Right V = V R + V 2 L V Left ω ω = V R V 2r L 65
Robot Football Robot Control Control System for one of the two wheels: V Θ Target + - Θ error PID ω demand + + V Right-dem. Robot x y V Left-dem. Θ robot Θ robot 66
Simulator Variables Variables ( robots have an ID from 0 to 4 in the simulator and 1 to 5 in the vision system ) env->currentball.pos.x env->currentball.pos.y env->home[id].pos.x env->home[id].pos.y env->home[id].rotation env->home[id].velocityleft env->home[id].velocityright
Guidance System Simulator extern "C" STRATEGY_API void Strategy ( Environment *env ) { int id = 0; double targetx = env->currentball.pos.x; double targety = env->currentball.pos.y; double dx = targetx - env->home[id].pos.x; double dy = targety - env->home[id].pos.y; double theta = atan2(dy,dx)*180.0/pi; double error = theta - env->home[id].rotation; double V = 20; env->home[id].velocityleft = V - error * 0.1; env->home[id].velocityright = V + error * 0.1; } 68
Limit angle to +/- 180 double limit(double angle){ double ret = angle; if(angle > 180.0) {ret = -(360.0 - angle);} else if(angle <= -180.0) {ret = (360.0 + angle);} if(angle > 180.0) {ret = -(360.0 - angle);} else if(angle <= -180.0) {ret = (360.0 + angle);} return ret; } error = limit(error); 69
Goal Keeper Where will the ball hit the goal? Hint: y = mx+ c
Role Selection Role selection Philosophies: Put closest player to the ball in charge Designate each player and area to play in Decisions influenced by if the player is in front of or behind the ball Decisions influenced by attacking or defending strategy Decisions can be made locally, from a robots point of few -> Swarm behaviour 71
Simulator vs Real System Less time delay in simulator ( one frame 1/60 ) Less noise in the simulator No friction, no slip! Controller tuning, speed reduction when switching from simulator to real system Frame rate 60fps in simulator, in real 30fps ( frame rate proportional to error and therefore proportional to the kp-gain in the controller )
Advanced Strategy: Avoidance with Vector Fields Robot Avoidance
Advanced Strategy: Vector Fields Wolf et al. (2004) 74
Advanced Strategy: Vector Fields 75
Advanced Strategy: Waypoints Alternative form of avoidance Uses a state-engine while vector fields may not need a state engine
Advanced Strategy: Waypoints: Striker Thinking like a striker. Strike Cone Strike Through Pos Strike Pos
Advanced Strategy: Waypoints: Defender Thinking like a defender.
Free Body Diagram m 1 mass of wheel I Inertia of wheel about 1 1 x=aθ G F F 1 = m x& R = 1 & 1+ m1 g R2 M Fa= I & θ 1 [1] [2] [3] F = µr 2 [4] only true on the limit, in fact 0 F µ R 2 79
Free Body Diagram F 1 = m x& 2 & R2 + R3 = m2 g F L 1 + R3b M = 0 [5] [6] [7] Aim to maximise R2 80
Free Body Diagram M is known [1], [5], [3] From [1] F F = = F 1 + m && x = m 1 ( m1 + m 2 )&& x 2 && x+ m && x 1 From [3] M ( m + m ax && = I && 1 2 ) 1θ 2 M ( m + m a && θ = I && 1 2 ) 1θ 2 [ I + ( m + m ) a ]&& θ = M 1 1 2 From [7] R b= M F L R 3 3 1 = [ M b 1 F L] = 1 1 [ b M 1 m & 2xL ] = [ M b m a & θ L] 2 R 3 known also & known θ & From [6] R 2 = m2g R3 R 2 known Check F R 2 < µ 81
Robot Football Comparison to Motor Sports Similarities: Low centre of gravity Low inertia Research on tyre material Race track timing to test performance Utilising latest technology, i.e. Motors,Camera
Robot Control: Tuning forward velocity vs. angular velocity v= ωr a a n n = = v 2 r 2 v = v ω vω Limit centripetal acceleration 83
Robot Control: Tuning Controlling slip: Traction control Measure wheel slip by detecting acceleration of the wheel that is higher than the robot can do given its mass and torque. Encoder counting -> test if too high -> cut power 84
Research Fields Multiple Camera Systems (see Wolf et al. 2005) Control Problems with Autonomous vehicles ( Path Planning, kinematics ) Predictive Control Research ( e.g. Kalman Filters ) Fast Vision Algorithms 85
Robot Football Benefits for Students Provides practical experience to students Students get in touch with latest technology producing capable engineers for industry Students are able to publish scientific papers as undergraduates Students get to travel around the world (next FIRA WorldCups are in South Korea and in South Africa?) 86
References Joerg Christian Wolf, Phil Hall, Paul Robinson, Phil Culverhouse, "Bioloid based Humanoid Soccer Robot Design" in the Proceedings of the Second Workshop on Humanoid Soccer Robots @ 2007 IEEE-RAS International Conference on Humanoid Robots, Pittsburgh (USA), November 29, 2007 J.C. Wolf, J.D. Oliver, P. Robinson and C. Diot, "Multi-site development of a FIRA large league robot football system" in the Proceedings of Third International Conference on Computational Intelligence, Robotics and Autonomous Systems, Singapore(CIRAS) 2005, (ISSN: 0219 6131), IEEE sponsored J.C. Wolf, P. Robinson, J.M. Davies, "VECTOR FIELD PATH PLANNING AND CONTROL OF AN AUTONOMOUS ROBOT IN A DYNAMIC ENVIRONMENT" in the Proceedings of the 2004 FIRA Robot World Congress (Paper 151) P.Robinson, J.C. Wolf, J.A.Law, J.D. Oliver, K.W.Young, D.A. Harewood-Gill "RECENT MIROSOT DEVELOPMENTS IN THE UK" in the Proceedings of the 2004 FIRA Robot World Congress (Paper 158) P.Robinson, P.Hall, J.Wolf, R.Phillips, C.Peck P.Culverhouse, R.Bray, AJ.Simpson, "The Technology and Challenges of Mirosot Robot Football" presented at the UK Championships of FIRA Robot Football 2004 87
Web Resources http://www.fira.net http://www.robocup.org For source codes, circuit diagrams, documentation the university has a FTPserver, please e-mail joerg to get the URL 88
Joerg Wolf was born in 1978 in Germany where he grew up. He is married and lives in England. He has gained his BEng degree in Robotics and Automated Systems from the University of Plymouth, U.K.in 2004. He joined the Centre for Robotics and Intelligent Systems at the university, where he completed his PhD in Human-Robot Interaction in 2008. In his young academic career, he has published 12 publications. Dr Wolf is a member of the IET and IEEE. In 2001 he joined the University s Robot Football team. He was team Manager of the Plymouth Drakes Robot football team from 2005-2007. Under his leadership, the Plymouth Drakes became U.K. Champion 4 times in a row. Dr Wolf is member of a Robot Football team that has presented England in international Robot Football competitions. Contributing to the team druring 15 competitions he has gained valuable experience in all areas of the FIRA MiroSot and HuroSot leagues. As a result he has been invited to the IET and to conferences to present his work. He worked with Merlin System Corp. in consulting and training Robot Football teams. He is currently starting a lectureship in Humanoid Robotics at the University of Plymouth. 89