Skip to content

Commit

Permalink
Added .proto files for simulation control from 'ssl-simulation-protoc…
Browse files Browse the repository at this point in the history
…ol' repo
  • Loading branch information
emielsteerneman committed Jul 31, 2023
1 parent 2f7d77e commit bbe4f08
Show file tree
Hide file tree
Showing 9 changed files with 481 additions and 0 deletions.
27 changes: 27 additions & 0 deletions roboteam_networking/proto/ssl_gc_common.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
syntax = "proto2";
option go_package = "github.com/RoboCup-SSL/ssl-simulation-protocol/pkg/sim";

// Team is either blue or yellow
enum Team {
// team not set
UNKNOWN = 0;
// yellow team
YELLOW = 1;
// blue team
BLUE = 2;
}

// RobotId is the combination of a team and a robot id
message RobotId {
// the robot number
optional uint32 id = 1;
// the team that the robot belongs to
optional Team team = 2;
}

// Division denotes the current division, which influences some rules
enum Division {
DIV_UNKNOWN = 0;
DIV_A = 1;
DIV_B = 2;
}
77 changes: 77 additions & 0 deletions roboteam_networking/proto/ssl_simulation_config.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
syntax = "proto2";
option go_package = "github.com/RoboCup-SSL/ssl-simulation-protocol/pkg/sim";

import "ssl_gc_common.proto";
import "ssl_vision_geometry.proto";
import "google/protobuf/any.proto";

// Movement limits for a robot
message RobotLimits {
// Max absolute speed-up acceleration [m/s^2]
optional float acc_speedup_absolute_max = 1;
// Max angular speed-up acceleration [rad/s^2]
optional float acc_speedup_angular_max = 2;
// Max absolute brake acceleration [m/s^2]
optional float acc_brake_absolute_max = 3;
// Max angular brake acceleration [rad/s^2]
optional float acc_brake_angular_max = 4;
// Max absolute velocity [m/s]
optional float vel_absolute_max = 5;
// Max angular velocity [rad/s]
optional float vel_angular_max = 6;
}

// Robot wheel angle configuration
// all angles are relative to looking forward,
// all wheels / angles are clockwise
message RobotWheelAngles {
// Angle front right [rad]
required float front_right = 1;
// Angle back right [rad]
required float back_right = 2;
// Angle back left [rad]
required float back_left = 3;
// Angle front left [rad]
required float front_left = 4;
}

// Specs of a robot
message RobotSpecs {
// Id of the robot
required RobotId id = 1;
// Robot radius [m]
optional float radius = 2 [default = 0.09];
// Robot height [m]
optional float height = 3 [default = 0.15];
// Robot mass [kg]
optional float mass = 4;
// Max linear kick speed [m/s] (unset = unlimited)
optional float max_linear_kick_speed = 7;
// Max chip kick speed [m/s] (unset = unlimited)
optional float max_chip_kick_speed = 8;
// Distance from robot center to dribbler [m] (implicitly defines the opening angle and dribbler width)
optional float center_to_dribbler = 9;
// Movement limits
optional RobotLimits limits = 10;
// Wheel angle configuration
optional RobotWheelAngles wheel_angles = 13;
// Custom robot spec for specific simulators (the protobuf files are managed by the simulators)
repeated google.protobuf.Any custom = 14;
}

message RealismConfig {
// Custom config for specific simulators (the protobuf files are managed by the simulators)
repeated google.protobuf.Any custom = 1;
}

// Change the simulator configuration
message SimulatorConfig {
// Update the geometry
optional SSL_GeometryData geometry = 1;
// Update the robot specs
repeated RobotSpecs robot_specs = 2;
// Update realism configuration
optional RealismConfig realism_config = 3;
// Change the vision publish port
optional uint32 vision_port = 4;
}
90 changes: 90 additions & 0 deletions roboteam_networking/proto/ssl_simulation_control.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
syntax = "proto2";
option go_package = "github.com/RoboCup-SSL/ssl-simulation-protocol/pkg/sim";

import "ssl_gc_common.proto";
import "ssl_simulation_config.proto";
import "ssl_simulation_error.proto";

// Teleport the ball to a new location and optionally set it to some velocity
message TeleportBall {
// x-coordinate [m]
optional float x = 1;
// y-coordinate [m]
optional float y = 2;
// z-coordinate (height) [m]
optional float z = 3;
// Velocity in x-direction [m/s]
optional float vx = 4;
// Velocity in y-direction [m/s]
optional float vy = 5;
// Velocity in z-direction [m/s]
optional float vz = 6;
// Teleport the ball safely to the target, for example by
// moving robots out of the way in case of collision and set speed of robots close-by to zero
optional bool teleport_safely = 7 [default = false];
// Adapt the angular ball velocity such that the ball is rolling
optional bool roll = 8 [default = false];
// Instead of teleporting the ball, apply some force to make sure
// the ball reaches the required position soon (velocity is ignored if true)
// WARNING: A command with by_force stays active (the move will take some time)
// until cancled by another TeleportBall command with by_force = false.
// To avoid teleporting the ball at the end and resetting its current spin,
// do not set any of the optional fields in this message to end the force without triggering
// an additional teleportation
optional bool by_force = 9 [ default = false];
}

// Teleport a robot to some location and give it a velocity
message TeleportRobot {
// Robot id to teleport
required RobotId id = 1;
// x-coordinate [m]
optional float x = 2;
// y-coordinate [m]
optional float y = 3;
// Orientation [rad], measured from the x-axis counter-clockwise
optional float orientation = 4;
// Global velocity [m/s] towards x-axis
optional float v_x = 5 [default = 0];
// Global velocity [m/s] towards y-axis
optional float v_y = 6 [default = 0];
// Angular velocity [rad/s]
optional float v_angular = 7 [default = 0];
// Robot should be present on the field?
// true -> robot will be added, if it does not exist yet
// false -> robot will be removed, if it is present
optional bool present = 8;
// Instead of teleporting, apply some force to make sure
// the robot reaches the required position soon (velocity is ignored if true)
// WARNING: A command with by_force stays active (the move will take some time)
// until cancled by another TeleportRobot command for the same bot with by_force = false.
// To avoid teleporting at the end,
// do not set any of the optional fields in this message
// to end the force without triggering
// an additional teleportation
optional bool by_force = 9 [ default = false];
}

// Control the simulation
message SimulatorControl {
// Teleport the ball
optional TeleportBall teleport_ball = 1;
// Teleport robots
repeated TeleportRobot teleport_robot = 2;
// Change the simulation speed
optional float simulation_speed = 3;
}

// Command from the connected client to the simulator
message SimulatorCommand {
// Control the simulation
optional SimulatorControl control = 1;
// Configure the simulation
optional SimulatorConfig config = 2;
}

// Response of the simulator to the connected client
message SimulatorResponse {
// List of errors, like using unsupported features
repeated SimulatorError errors = 1;
}
10 changes: 10 additions & 0 deletions roboteam_networking/proto/ssl_simulation_error.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto2";
option go_package = "github.com/RoboCup-SSL/ssl-simulation-protocol/pkg/sim";

// Errors in the simulator
message SimulatorError {
// Unique code of the error for automatic handling on client side
optional string code = 1;
// Human readable description of the error
optional string message = 2;
}
66 changes: 66 additions & 0 deletions roboteam_networking/proto/ssl_simulation_robot_control.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
syntax = "proto2";
option go_package = "github.com/RoboCup-SSL/ssl-simulation-protocol/pkg/sim";

// Full command for a single robot
message RobotCommand {
// Id of the robot
required uint32 id = 1;
// Movement command
optional RobotMoveCommand move_command = 2;
// Absolute (3 dimensional) kick speed [m/s]
optional float kick_speed = 3;
// Kick angle [degree] (defaults to 0 degrees for a straight kick)
optional float kick_angle = 4 [default = 0];
// Dribbler speed in rounds per minute [rpm]
optional float dribbler_speed = 5;
}

// Wrapper for different kinds of movement commands
message RobotMoveCommand {
oneof command {
// Move with wheel velocities
MoveWheelVelocity wheel_velocity = 1;
// Move with local velocity
MoveLocalVelocity local_velocity = 2;
// Move with global velocity
MoveGlobalVelocity global_velocity = 3;
}
}

// Move robot with wheel velocities
message MoveWheelVelocity {
// Velocity [m/s] of front right wheel
required float front_right = 1;
// Velocity [m/s] of back right wheel
required float back_right = 2;
// Velocity [m/s] of back left wheel
required float back_left = 3;
// Velocity [m/s] of front left wheel
required float front_left = 4;
}

// Move robot with local velocity
message MoveLocalVelocity {
// Velocity forward [m/s] (towards the dribbler)
required float forward = 1;
// Velocity to the left [m/s]
required float left = 2;
// Angular velocity counter-clockwise [rad/s]
required float angular = 3;
}

// Move robot with global velocity
message MoveGlobalVelocity {
// Velocity on x-axis of the field [m/s]
required float x = 1;
// Velocity on y-axis of the field [m/s]
required float y = 2;
// Angular velocity counter-clockwise [rad/s]
required float angular = 3;
}

// Command from the connected client to the simulator
message RobotControl {
// Control the robots
repeated RobotCommand robot_commands = 1;
}
23 changes: 23 additions & 0 deletions roboteam_networking/proto/ssl_simulation_robot_feedback.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax = "proto2";
option go_package = "github.com/RoboCup-SSL/ssl-simulation-protocol/pkg/sim";

import "ssl_simulation_error.proto";
import "google/protobuf/any.proto";

// Feedback from a robot
message RobotFeedback {
// Id of the robot
required uint32 id = 1;
// Has the dribbler contact to the ball right now
optional bool dribbler_ball_contact = 2;
// Custom robot feedback for specific simulators (the protobuf files are managed by the simulators)
optional google.protobuf.Any custom = 3;
}

// Response to RobotControl from the simulator to the connected client
message RobotControlResponse {
// List of errors, like using unsupported features
repeated SimulatorError errors = 1;
// Feedback of the robots
repeated RobotFeedback feedback = 2;
}
25 changes: 25 additions & 0 deletions roboteam_networking/proto/ssl_simulation_synchronous.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
syntax = "proto2";
option go_package = "github.com/RoboCup-SSL/ssl-simulation-protocol/pkg/sim";

import "ssl_vision_detection.proto";
import "ssl_simulation_robot_feedback.proto";
import "ssl_simulation_robot_control.proto";
import "ssl_simulation_control.proto";

// Request from the team to the simulator
message SimulationSyncRequest {
// The simulation step [s] to perform
optional float sim_step = 1;
// An optional simulator command
optional SimulatorCommand simulator_command = 2;
// An optional robot control command
optional RobotControl robot_control = 3;
}

// Response to last SimulationSyncRequest
message SimulationSyncResponse {
// List of detection frames for all cameras with the state after the simulation step in the request was performed
repeated SSL_DetectionFrame detection = 1;
// An optional robot control response
optional RobotControlResponse robot_control_response = 2;
}
33 changes: 33 additions & 0 deletions roboteam_networking/proto/ssl_vision_detection.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
syntax = "proto2";
option go_package = "github.com/RoboCup-SSL/ssl-simulation-protocol/pkg/sim";

message SSL_DetectionBall {
required float confidence = 1;
optional uint32 area = 2;
required float x = 3;
required float y = 4;
optional float z = 5;
required float pixel_x = 6;
required float pixel_y = 7;
}

message SSL_DetectionRobot {
required float confidence = 1;
optional uint32 robot_id = 2;
required float x = 3;
required float y = 4;
optional float orientation = 5;
required float pixel_x = 6;
required float pixel_y = 7;
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;
}
Loading

0 comments on commit bbe4f08

Please sign in to comment.