Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

combine exploration and production phase and support markerless gameplay #120

Merged
merged 18 commits into from
Apr 22, 2022

Conversation

TarikViehmann
Copy link
Contributor

This PR implements the changes required for robocup-logistics/rcll-rulebook#50 and should be merged only if the rule changes are accepted.
It takes care about 2 major things:

1. Markerless Machine Reporting

If a team decides to play without AR Tags, then they need to be able to report machines based on the type, zone and rotation. This will be possible through minor changes to the MachineReport messages:
1. The name is not a required field anymore in the reported machine, instead a type might be provided.

// Machine name and recognized type
// and zone the machine is in
optional string name = 1;
optional string type = 2;
optional Zone zone = 3;
optional uint32 rotation = 4; // [0-360] in deg

2. The MachineReportInfo that is returned will now contain feedback about a machine name and the belonging team, if a report with a correct type + zone was received
// Responses to reports that were received by the refbox and
// that contained machine types and zones
repeated MachineTypeFeedback reported_types = 3;
}
message MachineTypeFeedback {
enum CompType {
COMP_ID = 2000;
MSG_TYPE = 63;
}
// Feedback about whether a reported type in a zone is correct
// "name" and "team_color" are only set if the reported type is
// located in the zone and if the number of reported types did not
// exceed the number of machines with the types
required string type = 1;
required Zone zone = 2;
optional string name = 3;
optional Team team_color = 4;
}

The procedure to report a machine based on the machine type is now:

  1. Report type + zone (this does not give any points)
  2. Retrieve name + team
  3. Report name + zone + rotation (or use symmetry to report the machine if the retrieved name belongs to the opposing team)
    . This gives the usual points for machine reports.

Therefore, the refbox distinguishes between reports where the name is set and those, where the name is not set, but the type and the zone is set.
As before, once information about a machine name (zone, orientation) is reported, all attempts to re-report that info are ignored.
For reports only containing a machine type similar measurements are taken to prevent abuse by spamming report attempts:

  • Wrong reports about a machine type in a zone lead to a point deduction of the same amount as a wrongly reported zone would give. This prevents that teams can "probe" for a correct zone, even tho they know the machine name (because they play with tags) by first reporting a machine type in that zone before actually reporting using the name.
  • The number of attempts to report a machine type is limited to the number of machines of that type that belong to the reporting team, further reports towards that machine type are ignored.
    (deffunction type-can-be-reported (?type ?team)
    (bind ?num-reported-types (length$ (find-all-facts ((?exp exploration-report))
    (and (eq ?exp:team ?team)
    (eq ?exp:type ?type) (eq ?exp:rtype RECORD)
    )
    )))
    (bind ?num-machines-of-type (length$ (find-all-facts ((?m machine)) (and (eq ?m:mtype ?type) (eq ?m:team ?team)))))
    (return (< ?num-reported-types ?num-machines-of-type))
    )
  • Attempts to report a machine by its name are ignored, if the number of previously reported machines from that type are not exceeding the actual available machines (not counting successful type-reports, those are already limited through the point above).
    (deffunction machine-can-be-reported (?type ?team)
    (bind ?num-reported-types (length$ (find-all-facts ((?exp exploration-report))
    (or (and (eq ?exp:team ?team)
    (eq ?exp:type ?type)
    (eq ?exp:rtype RECORD)
    (eq ?exp:type-state WRONG_REPORT))
    (and (str-index (str-cat ?type) (str-cat ?exp:name))
    (eq ?exp:team ?team)
    (eq ?exp:rtype RECORD))
    )
    )))
    (bind ?num-machines-of-type (length$ (find-all-facts ((?m machine)) (and (eq ?m:mtype ?type) (eq ?m:team ?team)))))
    (return (< ?num-reported-types ?num-machines-of-type))
    )

    To give a few example scenarios, where C-CS1 is at C_Z22 and C-CS2 is at C_Z44:
  • report CS in M_Z22 -> report C-CS1 in C_Z22 -> report CS in C_Z44 -> report C-CS2 in C_Z44. This results in 2 correct zone reports (+2 for the 2 correct partial reports)
  • report CS in M_Z55 -> wrong zone report -> report CS in C_Z44 -> report C-CS2 in C_Z44. This results in 1 correct zone report (+1), one deduction for a wrong zone report (-1), all further attempts to report the machine C-CS1 are ignored, but the team could still report the type CS once, which would lead to either of the two scenarios:
    • either report CS in a correct zone, e.g., C_Z22 (feedback that C-CS1 is in that zone is given, but no points are awarded and reports about C-CS1 are still ignored)
    • or report CS in a wrong zone, e.g., C_Z23 (-1 point for a wrong zone report is given)
    • in either case, all further reports for C-CS1 or reports for type CS are ignored.
  • report CS in M_Z55 -> wrong zone report -> report CS in C_Z66 -> wrong zone report. This results in 0 correct reports, deductions for the two wrongly reported zones (-2), all further attempts to report the machine C-CS1, C-CS2 or a machine of type CS are ignored.

2. Combined Exploration + Production

A regular production phase now spans 20 minutes. If a machine is fully correctly reported, it can be used for production right away (before minute 3). Machine positions are only revealed after 3 minutes, which is also where all machines become usable for production (even if they were not or wrongly reported before).
The refbox also will switch from Setup to Production instead of Exploration now after 5 minutes of Setup.

Light patterns need to be consistent between exploration and production
steps and without overlaps
When reporting machines that do not have AR tags teams can only report a
machine type and zone at first.
They need to get feedback about the actual name and team color in return
(if the report was correct), which then can be used to properly report
the specific machine (or its mirrored counterpart in case a machine of
the opposite team was encountered).
If a team wants to report a machine that does not have an AR tag, then
it can only report a machine type and not its name.
Therefore, the refbox needs to answer by providing the name and the team
of the reported mps in case an incoming report has set the type + a zone
instead of the name.
This is done using MachineTypeFeedback messages.
Those only contain the name + zone, if an mps of the matching type is
actually in that zone and if a team did not try to report that machine
type to often already.
That means that for stations that only occur once (BS, SS, DS) a team
can only report these types once in hope to get an answer.
Reporting it again (e.g., at a different zone) leads to the report being
ignored.
Similarly, each team has two attempts to report RS and CS types.
@TarikViehmann TarikViehmann added the enhancement New feature or request label Mar 31, 2022
@TarikViehmann TarikViehmann requested review from snoato and a team March 31, 2022 16:34
@teamsolidus
Copy link

1

This is important, as otherwise teams could "probe" whether their zone
is correct by reporting just the machine type first, even if they play
with tags.
@TarikViehmann TarikViehmann force-pushed the tviehmann/combine-exploration branch from df3be83 to dbb5772 Compare April 7, 2022 09:49
@TarikViehmann TarikViehmann marked this pull request as ready for review April 18, 2022 10:07
@TarikViehmann TarikViehmann force-pushed the tviehmann/combine-exploration branch from c184326 to 52dcda5 Compare April 18, 2022 10:07
Copy link
Contributor

@snoato snoato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the hard work integrating the changes in the refbox quickly! Only a few minor comments and suggestions.

src/games/rcll/game.clp Show resolved Hide resolved
src/games/rcll/globals.clp Show resolved Hide resolved
src/games/rcll/machine-lights.clp Outdated Show resolved Hide resolved
TarikViehmann and others added 2 commits April 21, 2022 17:12
Co-authored-by: Daniel Swoboda <swoboda@kbsg.rwth-aachen.de>
Co-authored-by: Daniel Swoboda <swoboda@kbsg.rwth-aachen.de>
@TarikViehmann TarikViehmann merged commit 9992fd5 into master Apr 22, 2022
@TarikViehmann TarikViehmann deleted the tviehmann/combine-exploration branch April 22, 2022 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants