RoboCup trainer

Hello,

This year I want to try and train a team of agents using reinforcement learning in python. I have some questions about controlling the 2D simulator server using a trainer. Using the trainer (offline couch) I can start a match with the command “(start)” and stopped it with “(change_mode time_over)”. However, I don’t know how one resets the game clock to 0, using the trainer, to create a new match?

Also is it possible to reduce the time each cycle takes? Shorter game durations would allow for more experience to be collected. Thank you.

Hello,

the time for each cycle takes around 0.1 s but you can change some parameter in the server.conf (located in the ‘/home/your_user/.rcssserver’)
there is a Boolean named
server::synch_mode = false
change this to
server::synch_mode = true

and now the server wait for all the answers from the players if your agent is faster than 0.1s (99.99 percent of time it is) then you may save significant amounts of time for more games

about your first question ,I don’t think there is anything that can reset the timer to 0 but u can extend the time of match(in the server.conf) and also there is something named autotest2D from wrighteagle2d that can help you run games after games https://github.com/wrighteagle2d/autotest2d

feel free to ask :heart:
good luck my friend

Thank you very much :slight_smile:

I will definitely try your advice out.

Hello,

I am now trying the -server::synch_mode=true setting. When no players are connected to the server (with only a trainer) the game runs fast. The trainer just does the kickoffs automatically. However, when I add a player I get the message “Someone missed a cycle at 1”, “Someone missed a cycle at 2” and so forth. This is even though the one player does rotate as instructed for every cycle. The cycle now takes around 1 second and after too many missed messages the server exits. The message the player sends every 0.01 seconds to the server is “(turn 30)\x00” and every cycle I can see the player rotating through the monitor. I am not sure if the server is expecting a coach or some other command for every cycle? Is it possible to see what the server needs but is not receiving?

P.S. I also tried using all 22 players but still got the “Someone missed a cycle” message. Any advice will be appreciated.

Thank you

hi there @18183085 ,

there this new manual there is a part about coach and trainer


https://rcsoccersim.github.io/manual/index.html
do you execute commands like Body_TurnToBall().execute( agent ); ? if you did then your code must be too slow for the server wait time or you need the coach, I’m not sure about that but you can change the server waiting time


make a clone and download it
in the Staduim.cpp there is function called

Stadium::doSendThink()
const double max_msec_waited = 25 * 50;

you can read the code or just tune up the max_msec_watied * 10 :slight_smile:

GL HF

Thank you for your response. My code executes the turn command yes. Every agent just sends the command “(turn 30)\x00” to the server. I also don’t think my code takes to long. When -server::synch_mode=false my agents output multiple actions per second. It takes less than 0.001 seconds to execute as all it does is turn. When -server::synch_mode=true the correct commands do register on the monitor. The server then updates the players but also outputs the error message ‘Someone missed a cycle at x’. Does the server automatically wait for a couch as well? I did not add a couch so it should not have to wait for it.

The weird thing is that everything works perfectly when -server::synch_mode=false, but when -server::synch_mode=true the server says the someone took to long. Do players have to send a done command to the server?

I found my mistake, thanks. I did not send a done to the server. So the server was still waiting for more commands. Thanks for your help :slight_smile: