The team called Debrecen Round Forest FC++

Finally, to close the robot soccer examples, the Debrecen Deep Forest FC++ is further developed. The Debrecen Round Forest FC++ has already used the light response data from the simplified server. In addition, we improve the positioning of the players and introduce the usage of the online coach for this team to be developed.

The additional command line arguments of the simplified server

  • server::light_response

    If it is switched on, the simplified server will send back the player agent's own position.

  • server::light_response_with_angle

    If it is switched on, the simplified server will send back the player agent's own position and its own body angle.

  • server::light_response_with_angles

    If it is switched on, the simplified server will send back the player agent's own position and its own body and head angles.

The response of the simplified server

To test the response give the commands turn_neck 20 and turn 30.

thisclient->sndCmd("(turn_neck
            20)\0"); thisclient->sndCmd("(turn 30)\0"); ... std::cout
            << std::setw (6) << "squad " <<
            thisclient->bl.get_squad_number() << std::setw (10)
            << " time " << thisclient->bl.get_time() <<
            std::setw (5) << " x " << thisclient->bl.estx
            << std::setw (5) << " y " <<
            thisclient->bl.esty << std::setw (13) << " ang
            (body) " << thisclient->bl.esta * (180.0 / 3.14159265359)
            << std::setw (13) << " ang (neck) " <<
            thisclient->bl.estn * (180.0 / 3.14159265359) <<
            std::setw (13) << " ang (head) " <<
            thisclient->bl.head_angle << std::endl;

then investigate the output:

squad 4 time 0 x -12 y -37 ang (body) 31.5529 ang (neck)
            20 ang (head) 20 squad 4 time 0 x -12 y -37 ang (body) 31.5529 ang
            (neck) 20 ang (head) 20 squad 4 time 0 x -12 y -37 ang (body)
            31.5529 ang (neck) 20 ang (head) 20 squad 4 time 0 x -12 y -37 ang
            (body) 31.5529 ang (neck) 20 ang (head) 20 squad 4 time 0 x -12 y
            -37 ang (body) 31.5529 ang (neck) 20 ang (head) 20

and finally compare it to the soccerwindow2's debug information.

Figure 5.13. A portion of the soccerwindow2's log file.

A portion of the soccerwindow2's log file.

Receiving the response of the simplified server

The light response data and the estimated data are already handled separately in the lexer class:

// from light response float x;
            float y; float head_angle; // neck angle (rad) float body_angle;
            // (rad) // from classical estimations float estx; // x float
            esty; // y float esta; // body_angle (deg) float estn; //
            head_angle (deg) (from body_sense/head_angle)

Introducing the usage of the online coach

The Debrecen Round Forest FC++ has already used the online coach. To enable this feature we need to connect the default 6002 port and communicate using the online coach's protocol [RCSSMANUAL]. Now we are going to send the Debrecen Round Forest FC++'s XPM team logo as shown by the next code snippet:

std::snprintf(buf, 512,
          "(team_graphic (%d %d %s))", 0, 0, " \"8 8 1 1\" \" c None\" \" \"
          \" \" \" \" \" \" \" \" \" \" \" \" \" \" ");
          thisclient->sndCmd(buf); std::snprintf(buf, 512, "(team_graphic
          (%d %d %s))", 1, 0, " \"8 8 5 1\" \" c None\" \". c #1F1F1A\" \"+ c
          #2A2A24\" \"@ c #36362F\" \"# c #434239\" \" \" \" \" \" \" \" \" \"
          \" \" @#\" \" @@@\" \" ++..\" "); thisclient->sndCmd(buf);
          std::snprintf(buf, 512, "(team_graphic (%d %d %s))", 2, 0, " \"8 8 8
          1\" \" c None\" \". c #2A2A24\" \"+ c #36362F\" \"@ c #434239\" \"#
          c #504E44\" \"$ c #5C594E\" \"% c #666457\" \"& c #767365\" \"
          \" \" $\" \" $$$\" \" @##$%\" \"+@#$$%%$\" \"@#@@##$%\"
          \".@$###%&\" \"@%$$$$%&\" "); thisclient->sndCmd(buf);
          std::snprintf(buf, 512, "(team_graphic (%d %d %s))", 3, 0, " \"8 8 6
          1\"\" c None\"\". c #5C594E\"\"+ c #666457\"\"@ c #767365\"\"# c
          #8B8778\"\"$ c #9F9B89\"\"
          +@@##\"\".++@@@@@\"\"..++++@@\"\"@@@@####\"\"..++@@@@\"\"++@@####\"\"@###$$$$\"\"@###$$$$\"
          "); thisclient->sndCmd(buf); std::snprintf(buf, 512,
          "(team_graphic (%d %d %s))", 4, 0, " \"8 8 12 1\" \" c None\" \". c
          #2A2A24\" \"+ c #36362F\" \"@ c #434239\" \"# c #504E44\" \"$ c
          #5C594E\" \"% c #666457\" \"& c #767365\" \"* c #8B8778\" \"= c
          #9F9B89\" \"- c #B5B29E\" \"; c #C8C6B2\" \"$# * \" \"%$@%=-**\"
          \"&&&&****\" \"**======\" \"%%%%%&&*\"
          \"%$#.#&*=\" \"&%%+$&=;\" \"&%%+#%*;\" ");
          thisclient->sndCmd(buf); std::snprintf(buf, 512, "(team_graphic
          (%d %d %s))", 5, 0, " \"8 8 5 1\" \" c None\" \". c #8B8778\" \"+ c
          #9F9B89\" \"@ c #B5B29E\" \"# c #C8C6B2\" \" \" \". \" \"...+ \"
          \"+...++ \" \".++@+++.\" \"+.....++\" \"@..++++.\" \"#+.+@@@@\" ");
          thisclient->sndCmd(buf); std::snprintf(buf, 512, "(team_graphic
          (%d %d %s))", 6, 0, " \"8 8 4 1\" \" c None\" \". c #8B8778\" \"+ c
          #9F9B89\" \"@ c #B5B29E\" \" \" \" \" \" \" \" \" \" \" \"+ \" \"+++
          \" \"@+.+ \" "); thisclient->sndCmd(buf); std::snprintf(buf, 512,
          "(team_graphic (%d %d %s))", 7, 0, " \"8 8 1 1\" \" c None\" \" \"
          \" \" \" \" \" \" \" \" \" \" \" \" \" \" ");
          thisclient->sndCmd(buf);

The protocol supports only the png image format and can handle a maximum image size of 256x64. The team logo must be divided into tiles because the team_graphic command uses tiles of the size 8x8. The first two parameters of the command gives the coordinates of the given tile in the range of (0-31)x(0-7) then the third parameter is followed that gives the rows of the tile.

Example 5.5. Create the your own XPM team logo

This exercise is fully solved in Java in the book [MIRC]. All you have to do is to rewrite it into C++.


GIMP, GIMP, GIMP

Use the GIMP, it can save to XPM.

To connect the online coach we need to modify the starting script:

#!/bin/bash host=${1-localhost} portp=${2-6000}
          portc=${3-6002} team=${4-RForestFC++} for ((i=1;i<12;++i)) do
          src/rcsslightclient -host $host -port $portp -team $team -squad
          $i& sleep 1 done src/rcsslightclient -host $host -port $portc
          -team $team -squad 0& exit 0

In the window of the server we can see that the online coach has connected:

$ src/rcssserver server::light_response_with_angles=true
          rcssserver-15.1.0.light5.rf Copyright (C) 1995, 1996, 1997, 1998,
          1999 Electrotechnical Laboratory. 2000 - 2012 RoboCup Soccer
          Simulator Maintenance Group. Simulator Random Seed: 1345710410
          CSVSaver: Ready STDOutSaver: Ready Using simulator's random seed as
          Hetero Player Seed: 1345710410 wind factor: rand: 0.000000, vector:
          (0.000000, 0.000000) Hit CTRL-C to exit Light response: false Light
          response with angle: false Light response with angles: true A new
          (v15) player (RForestFC++ 1) connected. A new (v15) player
          (RForestFC++ 2) connected. A new (v15) player (RForestFC++ 3)
          connected. A new (v15) player (RForestFC++ 4) connected. A new (v4)
          monitor connected. A new (v15) player (RForestFC++ 5) connected. A
          new (v15) player (RForestFC++ 6) connected. A new (v15) player
          (RForestFC++ 7) connected. A new (v4) monitor connected. A new (v15)
          player (RForestFC++ 8) connected. A new (v15) player (RForestFC++ 9)
          connected. A new (v15) player (RForestFC++ 10) connected. A new
          (v15) player (RForestFC++ 11) connected. A new (v15) online coach
          (RForestFC++) connected.

Figure 5.14. The Debrecen Round Forest FC++'s team logo in the soccerwindow2 and the rcssmonitor.

The Debrecen Round Forest FC++'s team logo in the soccerwindow2 and the rcssmonitor.

Downloading the Debrecen Round Forest FC++

rcssserver-15.1.0.light5.rf.tar.bz2.