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

Protobuf update #135

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion roboteam_ai/src/stp/computations/PositionComputations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ void PositionComputations::calculateInfoForHarasser(std::unordered_map<std::stri
// project their point on the line
Vector2 projectedPoint = ourToBall.project(enemyClosestToBall->get()->getPos());
bool theyAreBetween = (projectedPoint != world->getWorld()->getBall()->get()->position);
bool theyAreCloser = (enemyClosestToBall->get()->getPos() - world->getWorld()->getBall()->get()->position).length() < (stpInfos["harasser"].getRobot()->get()->getPos() - world->getWorld()->getBall()->get()->position).length();
bool theyAreCloser = (enemyClosestToBall->get()->getPos() - world->getWorld()->getBall()->get()->position).length() <
(stpInfos["harasser"].getRobot()->get()->getPos() - world->getWorld()->getBall()->get()->position).length();
auto harasser = std::find_if(roles->begin(), roles->end(), [](const std::unique_ptr<Role> &role) { return role != nullptr && role->getName() == "harasser"; });
if (theyAreBetween && theyAreCloser) {
auto enemyPos = enemyClosestToBall->get()->getPos();
Expand Down
5 changes: 1 addition & 4 deletions roboteam_networking/proto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ protobuf_generate_cpp(NET_PROTO_SRCS NET_PROTO_HDRS
"messages_robocup_ssl_game_controller_geometry.proto"
"messages_robocup_ssl_game_event.proto"
"messages_robocup_ssl_geometry.proto"
"messages_robocup_ssl_geometry_legacy.proto"
"messages_robocup_ssl_referee.proto"
"messages_robocup_ssl_wrapper.proto"
"messages_robocup_ssl_wrapper_legacy.proto"

# Messages from ssl-simulation-control https://github.com/RoboCup-SSL/ssl-simulation-protocol/
"ssl_gc_common.proto"
Expand All @@ -16,10 +14,9 @@ protobuf_generate_cpp(NET_PROTO_SRCS NET_PROTO_HDRS
"ssl_simulation_error.proto"
"ssl_simulation_robot_control.proto"
"ssl_simulation_robot_feedback.proto"
"ssl_simulation_synchronous.proto"
"ssl_vision_detection.proto"
"ssl_vision_geometry.proto"

# Our own messages
"RobotCommands.proto"
"RobotFeedback.proto"
"State.proto"
Expand Down
41 changes: 33 additions & 8 deletions roboteam_networking/proto/messages_robocup_ssl_detection.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,57 @@ syntax = "proto2";
package proto;

message SSL_DetectionBall {
// Confidence in [0-1] of the detection
required float confidence = 1;
optional uint32 area = 2;
// X-coordinate in [mm] in global ssl-vision coordinate system
required float x = 3;
// Y-coordinate in [mm] in global ssl-vision coordinate system
required float y = 4;
// Z-coordinate in [mm] in global ssl-vision coordinate system
// Not supported by ssl-vision, but might be set by simulators
optional float z = 5;
// X-coordinate in [pixel] in the image
required float pixel_x = 6;
// Y-coordinate in [pixel] in the image
required float pixel_y = 7;
}

message SSL_DetectionRobot {
// Confidence in [0-1] of the detection
required float confidence = 1;
// Id of the robot
optional uint32 robot_id = 2;
// X-coordinate in [mm] in global ssl-vision coordinate system
required float x = 3;
// Y-coordinate in [mm] in global ssl-vision coordinate system
required float y = 4;
// Orientation in [rad]
optional float orientation = 5;
// X-coordinate in [pixel] in the image
required float pixel_x = 6;
// Y-coordinate in [pixel] in the image
required float pixel_y = 7;
// Height, as configured in ssl-vision for the respective team
optional float height = 8;
}

message SSL_DetectionFrame {
required uint32 frame_number = 1;
required double t_capture = 2;
required double t_sent = 3;
required uint32 camera_id = 4;
repeated SSL_DetectionBall balls = 5;
repeated SSL_DetectionRobot robots_yellow = 6;
repeated SSL_DetectionRobot robots_blue = 7;
}
// monotonously increasing frame number
required uint32 frame_number = 1;
// Unix timestamp in [seconds] at which the image has been received by ssl-vision
required double t_capture = 2;
// Unix timestamp in [seconds] at which this message has been sent to the network
required double t_sent = 3;
// Camera timestamp in [seconds] as reported by the camera, if supported
// This is not necessarily a unix timestamp
optional double t_capture_camera = 8;
// Identifier of the camera
required uint32 camera_id = 4;
// Detected balls
repeated SSL_DetectionBall balls = 5;
// Detected yellow robots
repeated SSL_DetectionRobot robots_yellow = 6;
// Detected blue robots
repeated SSL_DetectionRobot robots_blue = 7;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
syntax = "proto2";

package proto;

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

// Team is either blue or yellow
enum Team {
// team not set
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
syntax = "proto2";

package proto;

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

// A vector with two dimensions
message Vector2 {
required float x = 1;
Expand Down
50 changes: 12 additions & 38 deletions roboteam_networking/proto/messages_robocup_ssl_game_event.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
syntax = "proto2";

package proto;

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

import "messages_robocup_ssl_game_controller_common.proto";
import "messages_robocup_ssl_game_controller_geometry.proto";

Expand Down Expand Up @@ -79,36 +81,14 @@ message GameEvent {
MultipleCards multiple_cards = 32;
MultipleFouls multiple_fouls = 34;
BotSubstitution bot_substitution = 37;
ExcessiveBotSubstitution excessive_bot_substitution = 52;
TooManyRobots too_many_robots = 38;
ChallengeFlag challenge_flag = 46;
ChallengeFlagHandled challenge_flag_handled = 48;
EmergencyStop emergency_stop = 47;

UnsportingBehaviorMinor unsporting_behavior_minor = 35;
UnsportingBehaviorMajor unsporting_behavior_major = 36;

// Deprecated events

// replaced by ready_to_continue flag
// Prepared prepared = 1 [deprecated = true];
// // obsolete
// IndirectGoal indirect_goal = 9 [deprecated = true];
// // replaced by the meta-information in the possible_goal event
// ChippedGoal chipped_goal = 10 [deprecated = true];
// // obsolete
// KickTimeout kick_timeout = 12 [deprecated = true];
// // rule removed
// AttackerTouchedOpponentInDefenseArea attacker_touched_opponent_in_defense_area = 16 [deprecated = true];
// // obsolete
// AttackerTouchedOpponentInDefenseArea attacker_touched_opponent_in_defense_area_skipped = 42 [deprecated = true];
// // obsolete
// BotCrashUnique bot_crash_unique_skipped = 23 [deprecated = true];
// // can not be used as long as autoRefs do not judge pushing
// BotPushedBot bot_pushed_bot_skipped = 25 [deprecated = true];
// // rule removed
// DefenderInDefenseAreaPartially defender_in_defense_area_partially = 30 [deprecated = true];
// // the referee msg already indicates this
// MultiplePlacementFailures multiple_placement_failures = 33 [deprecated = true];
}

// the ball left the field normally
Expand Down Expand Up @@ -420,6 +400,8 @@ message GameEvent {
required Team by_team = 1;
// the remaining distance [m] from ball to placement position
optional float remaining_distance = 2;
// the distance [m] of the nearest own robot to the ball
optional float nearest_own_bot_distance = 3;
}
// a team was found guilty for minor unsporting behavior
message UnsportingBehaviorMinor {
Expand Down Expand Up @@ -465,6 +447,11 @@ message GameEvent {
// the team that substitutes robots
required Team by_team = 1;
}
// A foul for excessive bot substitutions
message ExcessiveBotSubstitution {
// the team that substitutes robots
required Team by_team = 1;
}
// A challenge flag, requested by a team previously, is flagged
message ChallengeFlag {
// the team that requested the challenge flag
Expand Down Expand Up @@ -544,6 +531,7 @@ message GameEvent {
DEFENDER_TOO_CLOSE_TO_KICK_POINT = 29; // triggered by autoRef
BOT_TOO_FAST_IN_STOP = 28; // triggered by autoRef
BOT_INTERFERED_PLACEMENT = 20; // triggered by autoRef
EXCESSIVE_BOT_SUBSTITUTION = 48; // triggered by GC

// Scoring goals

Expand All @@ -569,19 +557,5 @@ message GameEvent {

UNSPORTING_BEHAVIOR_MINOR = 35; // triggered by human ref
UNSPORTING_BEHAVIOR_MAJOR = 36; // triggered by human ref

// Deprecated events
/*
PREPARED = 1 [deprecated = true];
INDIRECT_GOAL = 9 [deprecated = true];
CHIPPED_GOAL = 10 [deprecated = true];
KICK_TIMEOUT = 12 [deprecated = true];
ATTACKER_TOUCHED_OPPONENT_IN_DEFENSE_AREA = 16 [deprecated = true];
ATTACKER_TOUCHED_OPPONENT_IN_DEFENSE_AREA_SKIPPED = 40 [deprecated = true];
BOT_CRASH_UNIQUE_SKIPPED = 23 [deprecated = true];
BOT_PUSHED_BOT_SKIPPED = 25 [deprecated = true];
DEFENDER_IN_DEFENSE_AREA_PARTIALLY = 30 [deprecated = true];
MULTIPLE_PLACEMENT_FAILURES = 33 [deprecated = true];
*/
}
}
17 changes: 16 additions & 1 deletion roboteam_networking/proto/messages_robocup_ssl_geometry.proto
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,40 @@ message SSL_FieldCircularArc {
}

message SSL_GeometryFieldSize {
// Field length (distance between goal lines) in mm
required int32 field_length = 1;
// Field width (distance between touch lines) in mm
required int32 field_width = 2;
// Goal width (distance between inner edges of goal posts) in mm
required int32 goal_width = 3;
// Goal depth (distance from outer goal line edge to inner goal back) in mm
required int32 goal_depth = 4;
// Boundary width (distance from touch/goal line centers to boundary walls) in mm
required int32 boundary_width = 5;
// Generated line segments based on the other parameters
repeated SSL_FieldLineSegment field_lines = 6;
// Generated circular arcs based on the other parameters
repeated SSL_FieldCircularArc field_arcs = 7;
// Depth of the penalty/defense area (measured between line centers) in mm
optional int32 penalty_area_depth = 8;
// Width of the penalty/defense area (measured between line centers) in mm
optional int32 penalty_area_width = 9;
// Radius of the center circle (measured between line centers) in mm
optional int32 center_circle_radius = 10;
// Thickness/width of the lines on the field in mm
optional int32 line_thickness = 11;
// Distance between the goal center and the center of the penalty mark in mm
optional int32 goal_center_to_penalty_mark = 12;
// Goal height in mm
optional int32 goal_height = 13;
// Ball radius in mm (note that this is a float type to represent sub-mm precision)
optional float ball_radius = 14;
// Max allowed robot radius in mm (note that this is a float type to represent sub-mm precision)
optional float max_robot_radius = 15;
}

message SSL_GeometryCameraCalibration {
required uint32 camera_id = 1;
required uint32 camera_id = 1;
required float focal_length = 2;
required float principal_point_x = 3;
required float principal_point_y = 4;
Expand Down

This file was deleted.

6 changes: 6 additions & 0 deletions roboteam_networking/proto/messages_robocup_ssl_referee.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
syntax = "proto2";
package proto;

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

import "messages_robocup_ssl_game_event.proto";

// Each UDP packet contains one of these messages.
Expand Down Expand Up @@ -149,6 +151,10 @@ message Referee {
optional bool ball_placement_failures_reached = 15;
// The team is allowed to substitute one or more robots currently
optional bool bot_substitution_allowed = 16;
// The number of bot substitutions left by the team in this halftime
optional uint32 bot_substitutions_left = 17;
// The number of microseconds left for current bot substitution
optional uint32 bot_substitution_time_left = 18;
}

// Information about the two teams.
Expand Down

This file was deleted.

25 changes: 0 additions & 25 deletions roboteam_networking/proto/ssl_simulation_synchronous.proto

This file was deleted.

33 changes: 0 additions & 33 deletions roboteam_networking/proto/ssl_vision_detection.proto

This file was deleted.

Loading
Loading