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

シミュレーションプロトコルに対応 #721

Merged
merged 25 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3599613
シミュレーションプロトコルを追加
HansRobo Feb 5, 2025
d43d5d8
シミュレーションプロトコルをメッセージ化
HansRobo Feb 5, 2025
27daedb
simulation_protocol_sender_nodeを実装
HansRobo Feb 5, 2025
1f095df
必要ないメッセージを削除
HansRobo Feb 5, 2025
7ca41e4
style(pre-commit): autofix
pre-commit-ci[bot] Feb 5, 2025
b7f7a23
スペルエラー修正
HansRobo Feb 5, 2025
c143977
必要ないコードを削除
HansRobo Feb 5, 2025
9f70390
試行錯誤
HansRobo Feb 5, 2025
31391ef
style(pre-commit): autofix
pre-commit-ci[bot] Feb 5, 2025
3b690e7
送信先の切り替え実装
HansRobo Feb 10, 2025
a715bc1
typo修正
HansRobo Feb 10, 2025
b7113d9
pre-commitエラー修正
HansRobo Feb 10, 2025
b2624f0
docker-compose.yamlのシミュレータを置き換え
HansRobo Feb 10, 2025
264d1ae
ペナルティエリアの補完を実装
HansRobo Feb 10, 2025
4c41920
GCのポートをTIGERs Sumatraに合わせて11003に変更
HansRobo Feb 10, 2025
55f33c8
senderを変更
HansRobo Feb 10, 2025
f686e85
ドキュメント追加
HansRobo Feb 10, 2025
088d12a
docker-compose.yamlにgrsimを残す
HansRobo Feb 11, 2025
4cfe574
Merge branch 'develop' into erforce-sim
HansRobo Feb 11, 2025
26545e8
senderの角度PIDゲインの変数名を修正
HansRobo Feb 12, 2025
fb1ada9
docker-compose.yamlで使うシミュレータをgrsimに戻す
HansRobo Feb 12, 2025
a70b784
senderをsim_senderに戻す
HansRobo Feb 12, 2025
df6356c
Merge branch 'develop' into erforce-sim
HansRobo Feb 12, 2025
73b61e5
シナリオ用docker-compose.yamlを整備
HansRobo Feb 13, 2025
5ef6c44
getNearestRobotWithDistanceFromPoint関数の事前チェックを徹底
HansRobo Feb 13, 2025
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 .github/workflows/custom_dict.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"NODEBUG",
"remmina",
"gltf",
"svgs"
"svgs",
"teleporting"
]
}
6 changes: 6 additions & 0 deletions consai_ros2/robocup_ssl_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ set(protobuf_files
proto/ssl_vision_detection_tracked.proto
proto/ssl_vision_wrapper.proto
proto/ssl_vision_wrapper_tracked.proto
proto/ssl_simulation_config.proto
proto/ssl_simulation_control.proto
proto/ssl_simulation_error.proto
proto/ssl_simulation_robot_control.proto
proto/ssl_simulation_robot_feedback.proto
proto/ssl_simulation_synchronous.proto
)
protobuf_generate_cpp(PROTO_CPP PROTO_H
${protobuf_files}
Expand Down
77 changes: 77 additions & 0 deletions consai_ros2/robocup_ssl_msgs/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 consai_ros2/robocup_ssl_msgs/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 canceled 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 canceled 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 consai_ros2/robocup_ssl_msgs/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;
}
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;
}
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;
}
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;
}
Loading