TIGERs-Mannheim / AutoReferee

An automatic referee for the RoboCup Small Size League
Other
23 stars 8 forks source link

Unable to Detect Game Events on a DIV_B field #6

Closed itsarune closed 8 months ago

itsarune commented 1 year ago

We have been trying to integrate the TIGERS autoref-ci branch into our AI vs AI gameplay and we seem to have trouble getting autoref to detect all gameplay events. We are able to see the TIGERS autoref publish NO_PROGRESS_IN_GAME and PLACEMENT_FAILED violations to the gamecontroller but we do not see events such as GOAL or BALL_LEFT_FIELD events.

We are playing AI vs AI on a DIV_B field, so we added the following DIV_B.txt to config/geometry/:

field: <
  field_length: 9000
  field_width: 6000
  goal_width: 1000
  goal_depth: 300
  boundary_width: 300
  penalty_area_depth: 1000
  penalty_area_width: 2000
  center_circle_radius: 500
  line_thickness: 10
  goal_center_to_penalty_mark: 6000
  goal_height: 160
  ball_radius: 21.5
  max_robot_radius: 90
>
models: <
    straight_two_phase: <
        acc_slide: -3
        acc_roll: -0.26
        k_switch: 0.64
    > 
    chip_fixed_loss: <
        damping_xy_first_hop: 0.75
        damping_xy_other_hops: 0.95
        damping_z: 0.5
    >
> 

I am unsure if I need to update another configuration file for our setup.

g3force commented 1 year ago

You have to reference DIV_B.txt in config/moduli/moduli.xml:

<geometry>DIV_A</geometry>

->

<geometry>DIV_B</geometry>
itsarune commented 1 year ago

I added the reference to DIV_B in config/moduli/module-ci.xml and config/moduli/moduli.xml but I still see the same issue

g3force commented 1 year ago

Just noticed: NO_PROGRESS_IN_GAME and PLACEMENT_FAILED is not send by the autoRef, but directly by GC. So it rather looks like the autoRef is not doing anything. How exactly are you running the autoRef? Have you checked in the GC UI or logs, if the autoRef actually connects to the GC?

itsarune commented 1 year ago

I am seeing log indications that autoRef is connecting to the gamecontroller instance I've set up. I'm getting these logs that seem to suggest that autoRef is connecting:

2023-07-17 23:39:56,718 INFO [main|VisionFilterImpl] Using threaded VisionFilter    

2023-07-17 23:39:56,762 INFO [AutoRefToGameControllerConnector|GameControllerProtocol] Connecting to localhost:10007

2023-07-17 23:39:56,762 INFO [main|AutoRefModule] Changed AutoRef mode to ACTIVE

2023-07-17 23:39:56,813 INFO [AutoRef CI Server|GeometryUpdater] Received geometry from vision

2023/07/17 23:39:56 AutoRef Client TIGERs AutoRef connected

2023-07-17 23:39:56,845 INFO [AutoRefToGameControllerConnector|AutoRefToGameControllerConnector] Successfully
registered AutoRef

2023/07/17 23:39:56 Tracker source ebbd4693-8f71-4724-a0a3-3cc93bdc82f7 timed out

2023/07/17 23:39:56 Publishing referee messages to 224.5.23.1:40001 at 127.0.0.1:43217

2023/07/17 23:39:56 Publishing referee messages to 224.5.23.1:40001 at 206.87.223.203:36738

2023/07/17 23:39:56 Publishing referee messages to 224.5.23.1:40001 at 172.17.0.1:56529

...

2023/07/17 23:39:56 Engine: Process change '{"revertible":true,"newCommand":{"command":{"type":"STOP","forTeam":"UNKNOWN"}}}'

2023/07/17 23:39:56 Processing change '{"revertible":true,"newCommand":{"command":{"type":"STOP","forTeam":"UNKNOWN"}}}'

...
2023/07/17 23:39:56 Add entry to state store

2023/07/17 23:39:56 Notify hook  messageGen

2023/07/17 23:39:56 Change produced 0 new changes

2023/07/17 23:39:56 Change '{"revertible":true,"newCommand":{"command":{"type":"STOP","forTeam":"UNKNOWN"}}}' processed

2023-07-17 23:39:56,861 INFO [AutoRefToGameControllerConnector|GameControllerProtocol] successfully connect to localhost:10007 after 84ms

2023/07/17 23:39:56 Switched tracker source to 71ac20a8-dba6-40dc-ab1e-a2fd629b707d (TIGERs)

2023-07-17 23:39:57,005 WARN [VisionFilter Processor|CamFilter] Non-consecutive cam frame for cam 0: 4 -> 84

2023-07-17 23:39:57,005 INFO [VisionFilter Processor|CamFilter] Resetting cam filter for cam 0

2023-07-17 23:39:57,015 WARN [VisionFilter Processor|CamFilter] Non-consecutive cam frame for cam 0: 84 -> 87

2023-07-17 23:39:57,017 WARN [VisionFilter Processor|CamFilter] Non-consecutive cam frame for cam 0: 87 -> 92

I've set up communication between Vision, Gamecontroller and autoRef by getting a SSL Wrapper packet from the Simulator, appending it to an AutoRefCIInput message and sending it over port 10013 to the running autoRef instance. I read the AutoRefCIOutput message and forward the TrackerWrapperPacket in that message to the Gamecontroller in a CIInput message. I tried to follow the documentation available here.

g3force commented 1 year ago

Looks pretty good :thinking: I need to take a closer look later.

g3force commented 1 year ago

I took a look at the whole autoRefCi stuff now again and also merged it into master, as the branch was pretty outdated already.

I have added instructions of how I tested everything here: https://github.com/RoboCup-SSL/ssl-game-controller/blob/master/cmd/ssl-auto-ref-ci-client/README.md#test-with-tigers-autoref

With those steps, I could simulate a ball_left_field event. Can you try to reproduce it on your side?

Also, have you started the autoRef with UI and verified that the geometry is correct in the visualizer?

itsarune commented 1 year ago

I haven't tried reproducing the ssl-auto-ref-ci-client yet. I will try that soon.

I was able to verify that the autoRef with UI in CI mode has the correct field geometry. image I can see that the ball speed indicator is working correctly but I don't really see anything being reported in the Game Log (which doesn't seem normal)

g3force commented 1 year ago

You can also see the current game state (e.g. HALT) in the top left corner of the visualizer. It should change, when you change the state in the GC. If it does not, check if you pass the referee messages correctly from GC to autoRef.

itsarune commented 1 year ago

Yes @g3force that was exactly the issue. I am now able to run ci mode with Autoref and detect all the expected game events (BALL_LEFT_FIELD, BALL_PLACEMENT_VIOLATION, MULTIPLE_FOULS etc.) I misunderstood how Autoref worked and didn't pass in the Referee message via the AutoRefCIInput proto. I thought it subscribed to Referee messages with the Gamecontroller and completely missed the RefereeMsg part in that reference.