Skip to content

Commit

Permalink
add (updated) proto files for manipulating GC
Browse files Browse the repository at this point in the history
  • Loading branch information
flimdejong committed Oct 2, 2024
1 parent fc42efc commit c62bad2
Show file tree
Hide file tree
Showing 38 changed files with 2,806 additions and 0 deletions.
5 changes: 5 additions & 0 deletions roboteam_networking/proto_CI/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore Python cache files
__pycache__/
*.pyc
*.pyo
*.pyd
5 changes: 5 additions & 0 deletions roboteam_networking/proto_CI/.gitignore.save
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore Python cache files
__pycache__/
*.pyc
*.pyo
*.pyd
7 changes: 7 additions & 0 deletions roboteam_networking/proto_CI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# CI (Continuous integration)

This folder contains all the files necessary to carry out CI mode using TCP to connect to the game controller (GC).

You need to get the ball information, robot information and geometry information. Then you need to send this as a packaged protobuf file to the GC. The "old" protobuf stuff to get information out of the system still uses the old protobuf files.

However we use these new files to establish a TCP connection using CI.
29 changes: 29 additions & 0 deletions roboteam_networking/proto_CI/ssl_autoref_ci.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto2";

option go_package = "github.com/RoboCup-SSL/ssl-game-controller/internal/app/ci/autoref";

import "ssl_vision_wrapper_tracked.proto";
import "ssl_vision_detection.proto";
import "ssl_vision_geometry.proto";
import "ssl_gc_referee_message.proto";

// The AutoRefCiInput contains all packets/messages that would otherwise be received through multicast by the auto-referee
// It may contain either a raw or a tracked SSL-vision packet. If both are given, the implementation may choose either one.
message AutoRefCiInput {
// Latest referee message
optional Referee referee_message = 1;
// A tracked SSL-Vision packet to be processed without filtering
optional TrackerWrapperPacket tracker_wrapper_packet = 2;
// A list of unfiltered SSL-Vision packets (for multiple cameras) to be filtered and processed
repeated SSL_DetectionFrame detection = 3;
// Current geometry data, to be sent at least once at the beginning of the connection
optional SSL_GeometryData geometry = 4;
}

// The AutoRefCiOutput contains any new data created by the auto-referee for further processing
message AutoRefCiOutput {
// A resulting tracked SSL-Vision packet for input into the ssl-game-controller.
// The auto-referee will either generate it from the unfiltered SSL-Vision packets
// or simply return the tracked packet from the input.
optional TrackerWrapperPacket tracker_wrapper_packet = 1;
}
56 changes: 56 additions & 0 deletions roboteam_networking/proto_CI/ssl_gc_api.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
syntax = "proto2";

option go_package = "github.com/RoboCup-SSL/ssl-game-controller/internal/app/api";

import "ssl_gc_state.proto";
import "ssl_gc_change.proto";
import "ssl_gc_engine.proto";
import "ssl_gc_engine_config.proto";

import "google/protobuf/duration.proto";

// Message format that is pushed from the GC to the client
message Output {
// The current match state
optional State match_state = 1;
// The current GC state
optional GcState gc_state = 2;
// The protocol
optional Protocol protocol = 3;
// The engine config
optional Config config = 4;
}

// The game protocol
message Protocol {
// Is this a delta only?
// Entries that were already sent are not sent again, because the protocol is immutable anyway.
// But if the game is reset, the whole protocol must be replaced. That's what this flag is for.
optional bool delta = 1;
// The (delta) list of entries
repeated ProtocolEntry entry = 2;
}

// A protocol entry of a change
message ProtocolEntry {
// Id of the entry
optional int32 id = 1;
// The change that was made
optional Change change = 2;
// The match time elapsed when this change was made
optional google.protobuf.Duration match_time_elapsed = 3;
// The stage time elapsed when this change was made
optional google.protobuf.Duration stage_time_elapsed = 4;
}

// Message format that can be send from the client to the GC
message Input {
// A change to be enqueued into the GC engine
optional Change change = 1;
// Reset the match
optional bool reset_match = 2;
// An updated config delta
optional Config config_delta = 3;
// Continue with action
optional ContinueAction continue_action = 4;
}
37 changes: 37 additions & 0 deletions roboteam_networking/proto_CI/ssl_gc_api_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

200 changes: 200 additions & 0 deletions roboteam_networking/proto_CI/ssl_gc_change.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
syntax = "proto2";

option go_package = "github.com/RoboCup-SSL/ssl-game-controller/internal/app/statemachine";

import "ssl_gc_state.proto";
import "ssl_gc_common.proto";
import "ssl_gc_geometry.proto";
import "ssl_gc_game_event.proto";
import "ssl_gc_referee_message.proto";

import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";

// A state change
message StateChange {
// A unique increasing id
optional int32 id = 1;
// The previous state
optional State state_pre = 2;
// The state after the change was applied
optional State state = 3;
// The change itself
optional Change change = 4;
// The timestamp when the change was triggered
optional google.protobuf.Timestamp timestamp = 5;
}

// A certain change
message Change {
// An identifier of the origin that triggered the change
optional string origin = 1;
// Is this change revertible?
optional bool revertible = 16;

oneof change {
NewCommand new_command_change = 2;
ChangeStage change_stage_change = 3;
SetBallPlacementPos set_ball_placement_pos_change = 4;
AddYellowCard add_yellow_card_change = 5;
AddRedCard add_red_card_change = 6;
YellowCardOver yellow_card_over_change = 7;
AddGameEvent add_game_event_change = 8;
AddPassiveGameEvent add_passive_game_event_change = 19;
AddProposal add_proposal_change = 9;
UpdateConfig update_config_change = 12;
UpdateTeamState update_team_state_change = 13;
SwitchColors switch_colors_change = 14;
Revert revert_change = 15;
NewGameState new_game_state_change = 17;
AcceptProposalGroup accept_proposal_group_change = 18;
SetStatusMessage set_status_message_change = 20;
}

// New referee command
message NewCommand {
// The command
optional Command command = 1;
}

// Switch to a new stage
message ChangeStage {
// The new stage
optional Referee.Stage new_stage = 1;
}

// Set the ball placement pos
message SetBallPlacementPos {
// The position in [m]
optional Vector2 pos = 1;
}

// Add a new yellow card
message AddYellowCard {
// The team that the card is for
optional Team for_team = 1;
// The game event that caused the card
optional GameEvent caused_by_game_event = 2;
}

// Add a new red card
message AddRedCard {
// The team that the card is for
optional Team for_team = 1;
// The game event that caused the card
optional GameEvent caused_by_game_event = 2;
}

// Trigger when a yellow card timed out
message YellowCardOver {
// The team that the card was for
optional Team for_team = 1;
}

// Add a new game event
message AddGameEvent {
// The game event
optional GameEvent game_event = 1;
}

// Add a new passive game event (that is only logged, but does not automatically trigger anything)
message AddPassiveGameEvent {
// The game event
optional GameEvent game_event = 1;
}

// Add a new proposal (i.e. from an auto referee for majority voting)
message AddProposal {
// The proposal
optional Proposal proposal = 1;
}

// Accept a proposal group (that contain one or more proposals of the same type)
message AcceptProposalGroup {
// The id of the group
optional string group_id = 3;
// An identifier of the acceptor
optional string accepted_by = 2;
}

// Update some configuration
message UpdateConfig {
// The division to play with
optional Division division = 1;
// the team that does/did the first kick off
optional Team first_kickoff_team = 2;
reserved 3; // auto_continue moved to gcState
// The match type
optional MatchType match_type = 4;
// The number of robots per team
optional google.protobuf.Int32Value max_robots_per_team = 5;
}

// Update the current state of a team (all fields that should be updated are set)
message UpdateTeamState {
// The team
optional Team for_team = 1;

// Change the name of the team
optional google.protobuf.StringValue team_name = 2;
// Change the number of goals that the teams has at the moment
optional google.protobuf.Int32Value goals = 3;
// The id of the goal keeper
optional google.protobuf.Int32Value goalkeeper = 4;
// The number of timeouts that the team has left
optional google.protobuf.Int32Value timeouts_left = 5;
// The timeout time that the team has left
optional google.protobuf.StringValue timeout_time_left = 6;
// Does the team play on the positive or the negative half (in ssl-vision coordinates)?
optional google.protobuf.BoolValue on_positive_half = 7;
// The number of ball placement failures
optional google.protobuf.Int32Value ball_placement_failures = 8;
// Can the team place the ball, or is ball placement for this team disabled and should be skipped?
optional google.protobuf.BoolValue can_place_ball = 9;
// The number of challenge flags that the team has left
optional google.protobuf.Int32Value challenge_flags_left = 21;
// The number of bot substitutions left by the team in this halftime
optional google.protobuf.Int32Value bot_substitutions_left = 22;
// Does the team want to substitute a robot in the next possible situation?
optional google.protobuf.BoolValue requests_bot_substitution = 10;
// Does the team want to take a timeout in the next possible situation?
optional google.protobuf.BoolValue requests_timeout = 17;
// Does the team want to challenge a recent decision of the referee?
optional google.protobuf.BoolValue requests_challenge = 18;
// Does the team want to request an emergency stop?
optional google.protobuf.BoolValue requests_emergency_stop = 19;
// Update a certain yellow card of the team
optional YellowCard yellow_card = 20;
// Update a certain red card of the team
optional RedCard red_card = 12;
// Update a certain foul of the team
optional Foul foul = 13;
// Remove the yellow card with this id
optional google.protobuf.UInt32Value remove_yellow_card = 14;
// Remove the red card with this id
optional google.protobuf.UInt32Value remove_red_card = 15;
// Remove the foul with this id
optional google.protobuf.UInt32Value remove_foul = 16;
}

// Switch the team colors
message SwitchColors {
}

// Revert a certain change
message Revert {
// The id of the change
optional int32 change_id = 1;
}

// Change the current game state
message NewGameState {
// The new game state
optional GameState game_state = 1;
}

message SetStatusMessage {
// The new status message
optional string status_message = 1;
}
}
Loading

0 comments on commit c62bad2

Please sign in to comment.