From 1c19aaeb08d73397fff0c45c5194786d2f5284b8 Mon Sep 17 00:00:00 2001 From: Kotaro Yoshimoto Date: Thu, 17 Oct 2024 01:45:50 +0900 Subject: [PATCH] =?UTF-8?q?proto=E3=81=AE=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../robocup_ssl_comm/vision_component.hpp | 6 +- consai_ros2/robocup_ssl_msgs/CMakeLists.txt | 10 +- .../proto/messages_robocup_ssl_geometry.proto | 128 ---------------- .../proto/messages_robocup_ssl_wrapper.proto | 8 - ...ction.proto => ssl_vision_detection.proto} | 2 + ...oto => ssl_vision_detection_tracked.proto} | 35 +---- .../proto/ssl_vision_geometry.proto | 137 ++++++++++++++++++ .../proto/ssl_vision_wrapper.proto | 11 ++ ...proto => ssl_vision_wrapper_tracked.proto} | 5 +- 9 files changed, 167 insertions(+), 175 deletions(-) delete mode 100644 consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_geometry.proto delete mode 100644 consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_wrapper.proto rename consai_ros2/robocup_ssl_msgs/proto/{messages_robocup_ssl_detection.proto => ssl_vision_detection.proto} (91%) rename consai_ros2/robocup_ssl_msgs/proto/{messages_robocup_ssl_detection_tracked.proto => ssl_vision_detection_tracked.proto} (83%) create mode 100644 consai_ros2/robocup_ssl_msgs/proto/ssl_vision_geometry.proto create mode 100644 consai_ros2/robocup_ssl_msgs/proto/ssl_vision_wrapper.proto rename consai_ros2/robocup_ssl_msgs/proto/{messages_robocup_ssl_wrapper_tracked.proto => ssl_vision_wrapper_tracked.proto} (81%) diff --git a/consai_ros2/robocup_ssl_comm/include/robocup_ssl_comm/vision_component.hpp b/consai_ros2/robocup_ssl_comm/include/robocup_ssl_comm/vision_component.hpp index 8c7fe6239..3c469bead 100644 --- a/consai_ros2/robocup_ssl_comm/include/robocup_ssl_comm/vision_component.hpp +++ b/consai_ros2/robocup_ssl_comm/include/robocup_ssl_comm/vision_component.hpp @@ -15,9 +15,9 @@ #ifndef ROBOCUP_SSL_COMM__VISION_COMPONENT_HPP_ #define ROBOCUP_SSL_COMM__VISION_COMPONENT_HPP_ -#include -#include -#include +#include +#include +#include #include #include diff --git a/consai_ros2/robocup_ssl_msgs/CMakeLists.txt b/consai_ros2/robocup_ssl_msgs/CMakeLists.txt index e7c037048..8423fd466 100644 --- a/consai_ros2/robocup_ssl_msgs/CMakeLists.txt +++ b/consai_ros2/robocup_ssl_msgs/CMakeLists.txt @@ -28,15 +28,15 @@ set(protobuf_files proto/grSim_Packet.proto proto/grSim_Replacement.proto proto/grSim_Robotstatus.proto - proto/messages_robocup_ssl_wrapper.proto - proto/messages_robocup_ssl_wrapper_tracked.proto - proto/messages_robocup_ssl_geometry.proto - proto/messages_robocup_ssl_detection.proto - proto/messages_robocup_ssl_detection_tracked.proto proto/ssl_gc_common.proto proto/ssl_gc_game_event.proto proto/ssl_gc_geometry.proto proto/ssl_gc_referee_message.proto + proto/ssl_vision_geometry.proto + proto/ssl_vision_detection.proto + proto/ssl_vision_detection_tracked.proto + proto/ssl_vision_wrapper.proto + proto/ssl_vision_wrapper_tracked.proto ) protobuf_generate_cpp(PROTO_CPP PROTO_H ${protobuf_files} diff --git a/consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_geometry.proto b/consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_geometry.proto deleted file mode 100644 index 5e5537d6a..000000000 --- a/consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_geometry.proto +++ /dev/null @@ -1,128 +0,0 @@ -syntax = "proto2"; -// A 2D float vector. -message Vector2f { - required float x = 1; - required float y = 2; -} - -// Represents a field marking as a line segment represented by a start point p1, -// and end point p2, and a line thickness. The start and end points are along -// the center of the line, so the thickness of the line extends by thickness / 2 -// on either side of the line. -message SSL_FieldLineSegment { - // Name of this field marking. - required string name = 1; - // Start point of the line segment. - required Vector2f p1 = 2; - // End point of the line segment. - required Vector2f p2 = 3; - // Thickness of the line segment. - required float thickness = 4; - // The type of this shape - optional SSL_FieldShapeType type = 5; -} - -// Represents a field marking as a circular arc segment represented by center point, a -// start angle, an end angle, and an arc thickness. -message SSL_FieldCircularArc { - // Name of this field marking. - required string name = 1; - // Center point of the circular arc. - required Vector2f center = 2; - // Radius of the arc. - required float radius = 3; - // Start angle in counter-clockwise order. - required float a1 = 4; - // End angle in counter-clockwise order. - required float a2 = 5; - // Thickness of the arc. - required float thickness = 6; - // The type of this shape - optional SSL_FieldShapeType type = 7; -} - -message SSL_GeometryFieldSize { - required int32 field_length = 1; - required int32 field_width = 2; - required int32 goal_width = 3; - required int32 goal_depth = 4; - required int32 boundary_width = 5; - repeated SSL_FieldLineSegment field_lines = 6; - repeated SSL_FieldCircularArc field_arcs = 7; - optional int32 penalty_area_depth = 8; - optional int32 penalty_area_width = 9; -} - -message SSL_GeometryCameraCalibration { - required uint32 camera_id = 1; - required float focal_length = 2; - required float principal_point_x = 3; - required float principal_point_y = 4; - required float distortion = 5; - required float q0 = 6; - required float q1 = 7; - required float q2 = 8; - required float q3 = 9; - required float tx = 10; - required float ty = 11; - required float tz = 12; - optional float derived_camera_world_tx = 13; - optional float derived_camera_world_ty = 14; - optional float derived_camera_world_tz = 15; - optional uint32 pixel_image_width = 16; - optional uint32 pixel_image_height = 17; -} - -// Two-Phase model for straight-kicked balls. -// There are two phases with different accelerations during the ball kicks: -// 1. Sliding -// 2. Rolling -// The full model is described in the TDP of ER-Force from 2016, which can be found here: -// https://ssl.robocup.org/wp-content/uploads/2019/01/2016_ETDP_ER-Force.pdf -message SSL_BallModelStraightTwoPhase { - // Ball sliding acceleration [m/s^2] (should be negative) - required double acc_slide = 1; - // Ball rolling acceleration [m/s^2] (should be negative) - required double acc_roll = 2; - // Fraction of the initial velocity where the ball starts to roll - required double k_switch = 3; -} - -// Fixed-Loss model for chipped balls. -// Uses fixed damping factors for xy and z direction per hop. -message SSL_BallModelChipFixedLoss { - // Chip kick velocity damping factor in XY direction for the first hop - required double damping_xy_first_hop = 1; - // Chip kick velocity damping factor in XY direction for all following hops - required double damping_xy_other_hops = 2; - // Chip kick velocity damping factor in Z direction for all hops - required double damping_z = 3; -} - -message SSL_GeometryModels { - optional SSL_BallModelStraightTwoPhase straight_two_phase = 1; - optional SSL_BallModelChipFixedLoss chip_fixed_loss = 2; -} - -message SSL_GeometryData { - required SSL_GeometryFieldSize field = 1; - repeated SSL_GeometryCameraCalibration calib = 2; - optional SSL_GeometryModels models = 3; -} - -enum SSL_FieldShapeType { - Undefined = 0; - CenterCircle = 1; - TopTouchLine = 2; - BottomTouchLine = 3; - LeftGoalLine = 4; - RightGoalLine = 5; - HalfwayLine = 6; - CenterLine = 7; - LeftPenaltyStretch = 8; - RightPenaltyStretch = 9; - LeftFieldLeftPenaltyStretch = 10; - LeftFieldRightPenaltyStretch = 11; - RightFieldLeftPenaltyStretch = 12; - RightFieldRightPenaltyStretch = 13; -} diff --git a/consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_wrapper.proto b/consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_wrapper.proto deleted file mode 100644 index 4b4e3e28d..000000000 --- a/consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_wrapper.proto +++ /dev/null @@ -1,8 +0,0 @@ -syntax = "proto2"; -import "messages_robocup_ssl_detection.proto"; -import "messages_robocup_ssl_geometry.proto"; - -message SSL_WrapperPacket { - optional SSL_DetectionFrame detection = 1; - optional SSL_GeometryData geometry = 2; -} diff --git a/consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_detection.proto b/consai_ros2/robocup_ssl_msgs/proto/ssl_vision_detection.proto similarity index 91% rename from consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_detection.proto rename to consai_ros2/robocup_ssl_msgs/proto/ssl_vision_detection.proto index 918748c11..f81bd5cb0 100644 --- a/consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_detection.proto +++ b/consai_ros2/robocup_ssl_msgs/proto/ssl_vision_detection.proto @@ -1,5 +1,7 @@ syntax = "proto2"; +option go_package = "github.com/RoboCup-SSL/ssl-game-controller/internal/app/vision"; + message SSL_DetectionBall { required float confidence = 1; optional uint32 area = 2; diff --git a/consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_detection_tracked.proto b/consai_ros2/robocup_ssl_msgs/proto/ssl_vision_detection_tracked.proto similarity index 83% rename from consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_detection_tracked.proto rename to consai_ros2/robocup_ssl_msgs/proto/ssl_vision_detection_tracked.proto index 5d1079aa2..8282aa14e 100644 --- a/consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_detection_tracked.proto +++ b/consai_ros2/robocup_ssl_msgs/proto/ssl_vision_detection_tracked.proto @@ -1,37 +1,11 @@ syntax = "proto2"; -// Default network address: 224.5.23.2:10010 - -// A vector with two dimensions -message Vector2 { - required float x = 1; - required float y = 2; -} - -// A vector with three dimensions -message Vector3 { - required float x = 1; - required float y = 2; - required float z = 3; -} +option go_package = "github.com/RoboCup-SSL/ssl-game-controller/internal/app/tracker"; -// The team color of the robot -enum TeamColor { - // team not set - TEAM_COLOR_UNKNOWN = 0; - // yellow team - TEAM_COLOR_YELLOW = 1; - // blue team - TEAM_COLOR_BLUE = 2; -} +import "ssl_gc_common.proto"; +import "ssl_gc_geometry.proto"; -// A unique robot id with team information -message RobotId { - // The robot number - required uint32 id = 1; - // The team color - required TeamColor team_color = 2; -} +// Default network address: 224.5.23.2:10010 // Capabilities that a source implementation can have enum Capability { @@ -98,6 +72,7 @@ message TrackedFrame { // A monotonous increasing frame counter required uint32 frame_number = 1; // The unix timestamp in [s] of the data + // If timestamp is larger than timestamp_captured, the source has applied a prediction already required double timestamp = 2; // The list of detected balls diff --git a/consai_ros2/robocup_ssl_msgs/proto/ssl_vision_geometry.proto b/consai_ros2/robocup_ssl_msgs/proto/ssl_vision_geometry.proto new file mode 100644 index 000000000..fe71281e4 --- /dev/null +++ b/consai_ros2/robocup_ssl_msgs/proto/ssl_vision_geometry.proto @@ -0,0 +1,137 @@ +syntax = "proto2"; + +option go_package = "github.com/RoboCup-SSL/ssl-game-controller/internal/app/vision"; + +// A 2D float vector. +message Vector2f { + required float x = 1; + required float y = 2; +} + +// Represents a field marking as a line segment represented by a start point p1, +// and end point p2, and a line thickness. The start and end points are along +// the center of the line, so the thickness of the line extends by thickness / 2 +// on either side of the line. +message SSL_FieldLineSegment { + // Name of this field marking. + required string name = 1; + // Start point of the line segment. + required Vector2f p1 = 2; + // End point of the line segment. + required Vector2f p2 = 3; + // Thickness of the line segment. + required float thickness = 4; + // The type of this shape + optional SSL_FieldShapeType type = 5; +} + +// Represents a field marking as a circular arc segment represented by center point, a +// start angle, an end angle, and an arc thickness. +message SSL_FieldCircularArc { + // Name of this field marking. + required string name = 1; + // Center point of the circular arc. + required Vector2f center = 2; + // Radius of the arc. + required float radius = 3; + // Start angle in counter-clockwise order. + required float a1 = 4; + // End angle in counter-clockwise order. + required float a2 = 5; + // Thickness of the arc. + required float thickness = 6; + // The type of this shape + optional SSL_FieldShapeType type = 7; +} + +message SSL_GeometryFieldSize { + required int32 field_length = 1; + required int32 field_width = 2; + required int32 goal_width = 3; + required int32 goal_depth = 4; + required int32 boundary_width = 5; + repeated SSL_FieldLineSegment field_lines = 6; + repeated SSL_FieldCircularArc field_arcs = 7; + optional int32 penalty_area_depth = 8; + optional int32 penalty_area_width = 9; + optional int32 center_circle_radius = 10; + optional int32 line_thickness = 11; + optional int32 goal_center_to_penalty_mark = 12; + optional int32 goal_height = 13; + optional float ball_radius = 14; + optional float max_robot_radius = 15; +} + +message SSL_GeometryCameraCalibration { + required uint32 camera_id = 1; + required float focal_length = 2; + required float principal_point_x = 3; + required float principal_point_y = 4; + required float distortion = 5; + required float q0 = 6; + required float q1 = 7; + required float q2 = 8; + required float q3 = 9; + required float tx = 10; + required float ty = 11; + required float tz = 12; + optional float derived_camera_world_tx = 13; + optional float derived_camera_world_ty = 14; + optional float derived_camera_world_tz = 15; + optional uint32 pixel_image_width = 16; + optional uint32 pixel_image_height = 17; +} + +// Two-Phase model for straight-kicked balls. +// There are two phases with different accelerations during the ball kicks: +// 1. Sliding +// 2. Rolling +// The full model is described in the TDP of ER-Force from 2016, which can be found here: +// https://ssl.robocup.org/wp-content/uploads/2019/01/2016_ETDP_ER-Force.pdf +message SSL_BallModelStraightTwoPhase { + // Ball sliding acceleration [m/s^2] (should be negative) + required double acc_slide = 1; + // Ball rolling acceleration [m/s^2] (should be negative) + required double acc_roll = 2; + // Fraction of the initial velocity where the ball starts to roll + required double k_switch = 3; +} + +// Fixed-Loss model for chipped balls. +// Uses fixed damping factors for xy and z direction per hop. +message SSL_BallModelChipFixedLoss { + // Chip kick velocity damping factor in XY direction for the first hop + required double damping_xy_first_hop = 1; + // Chip kick velocity damping factor in XY direction for all following hops + required double damping_xy_other_hops = 2; + // Chip kick velocity damping factor in Z direction for all hops + required double damping_z = 3; +} + +message SSL_GeometryModels { + optional SSL_BallModelStraightTwoPhase straight_two_phase = 1; + optional SSL_BallModelChipFixedLoss chip_fixed_loss = 2; +} + +message SSL_GeometryData { + required SSL_GeometryFieldSize field = 1; + repeated SSL_GeometryCameraCalibration calib = 2; + optional SSL_GeometryModels models = 3; +} + +enum SSL_FieldShapeType { + Undefined = 0; + CenterCircle = 1; + TopTouchLine = 2; + BottomTouchLine = 3; + LeftGoalLine = 4; + RightGoalLine = 5; + HalfwayLine = 6; + CenterLine = 7; + LeftPenaltyStretch = 8; + RightPenaltyStretch = 9; + LeftFieldLeftPenaltyStretch = 10; + LeftFieldRightPenaltyStretch = 11; + RightFieldLeftPenaltyStretch = 12; + RightFieldRightPenaltyStretch = 13; +} diff --git a/consai_ros2/robocup_ssl_msgs/proto/ssl_vision_wrapper.proto b/consai_ros2/robocup_ssl_msgs/proto/ssl_vision_wrapper.proto new file mode 100644 index 000000000..66bb0d009 --- /dev/null +++ b/consai_ros2/robocup_ssl_msgs/proto/ssl_vision_wrapper.proto @@ -0,0 +1,11 @@ +syntax = "proto2"; + +option go_package = "github.com/RoboCup-SSL/ssl-game-controller/internal/app/vision"; + +import "ssl_vision_detection.proto"; +import "ssl_vision_geometry.proto"; + +message SSL_WrapperPacket { + optional SSL_DetectionFrame detection = 1; + optional SSL_GeometryData geometry = 2; +} diff --git a/consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_wrapper_tracked.proto b/consai_ros2/robocup_ssl_msgs/proto/ssl_vision_wrapper_tracked.proto similarity index 81% rename from consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_wrapper_tracked.proto rename to consai_ros2/robocup_ssl_msgs/proto/ssl_vision_wrapper_tracked.proto index 3a7ebabb0..82d787285 100644 --- a/consai_ros2/robocup_ssl_msgs/proto/messages_robocup_ssl_wrapper_tracked.proto +++ b/consai_ros2/robocup_ssl_msgs/proto/ssl_vision_wrapper_tracked.proto @@ -1,5 +1,8 @@ syntax = "proto2"; -import "messages_robocup_ssl_detection_tracked.proto"; + +option go_package = "github.com/RoboCup-SSL/ssl-game-controller/internal/app/tracker"; + +import "ssl_vision_detection_tracked.proto"; // A wrapper packet containing meta data of the source // Also serves for the possibility to extend the protocol later