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

new interface #44

Open
wants to merge 11 commits into
base: development
Choose a base branch
from
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS
# New interface
${PROTO_BASE_PATH}/UiOptions.proto
${PROTO_BASE_PATH}/Handshake.proto
${PROTO_BASE_PATH}/JoystickData.proto


# SSL Simulation Protocol - Robocup 2021
Expand All @@ -63,6 +64,9 @@ protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS
${PROTO_BASE_PATH}/ssl_simulation_synchronous.proto
${PROTO_BASE_PATH}/ssl_vision_detection.proto
${PROTO_BASE_PATH}/ssl_vision_geometry.proto

${PROTO_BASE_PATH}/ObserverSettings.proto
${PROTO_BASE_PATH}/RobotHubSettings.proto
)

add_library(roboteam_proto STATIC
Expand Down
10 changes: 4 additions & 6 deletions proto/Handshake.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ package proto;

import "UiOptions.proto";

// A message which contains either a list of declarations or a list of values for a single module.
message Handshake {
daw1012345 marked this conversation as resolved.
Show resolved Hide resolved
string name = 1;
repeated UiOption options = 2;
}

message HandshakeAccumulation {
repeated Handshake handshakes = 1;
string module_name = 1;
UiOptionDeclarations declarations = 2;
rolfvdhulst marked this conversation as resolved.
Show resolved Hide resolved
UiValues values = 3;
}
9 changes: 9 additions & 0 deletions proto/JoystickData.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";

package proto;

message JoystickState { // 0 - 100 values
sint32 x = 1;
sint32 y = 2;
sint32 z = 3;
}
10 changes: 10 additions & 0 deletions proto/ObserverSettings.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto3";

package proto;

message ObserverSettings {
string visionIp = 1;
uint32 visionPort = 2;
string refereeIp = 3;
uint32 refereePort = 4;
}
9 changes: 9 additions & 0 deletions proto/RobotHubSettings.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";

package proto;

message RobotHubSettings {
bool serialMode = 1;
string robothubIP = 2;
uint32 robothubPort = 3;
}
18 changes: 6 additions & 12 deletions proto/Setting.proto
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
syntax = "proto3";


import "RobotHubSettings.proto";
import "ObserverSettings.proto";

package proto;

message Setting {
uint32 id = 1; // the id of the AI which this setting corresponds to
bool isYellow = 2;
bool isLeft = 3;
bool serialMode = 4;

// ports
string visionIp = 5;
uint32 visionPort = 6;
string refereeIp = 7;
uint32 refereePort = 8;
string robothubSendIp = 9;
uint32 robothubSendPort = 10;
RobotHubSettings rh_settings = 1;
ObserverSettings obs_settings = 2;
}
10 changes: 2 additions & 8 deletions proto/State.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

import "World.proto";
import "RobotParameters.proto";
import "JoystickData.proto";

import "messages_robocup_ssl_wrapper.proto";
import "messages_robocup_ssl_referee.proto";
Expand All @@ -23,15 +24,8 @@ message State {
repeated SSL_Referee processed_referee_packets = 11;
}

message SystemState{
State state = 1;
UiSettings ui_settings = 2;
}

message HandshakeState {
State state = 1;
}
message ModuleState {
SystemState system_state = 1;
State system_state = 1;
repeated Handshake handshakes = 2;
}
34 changes: 19 additions & 15 deletions proto/UiOptions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,53 @@ message Slider {
float max = 3;
float interval = 4;
float default = 5;
int32 dpi = 6;
}

message Checkbox {
string text = 1;
bool default = 2;
}

message Dropdown {
string text = 1;
int64 default = 2;
repeated string options = 3;
}

message RadioButton {
int64 default = 1;
repeated string options = 2;
}

message TextField {
string text = 1;
}

message UiOption {
string name = 1;
message UiOptionDeclaration {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, the one thing I'm unsure about is how we'll toggle the mutability of a field. Should this be a boolean here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one, I'll add it. Worst case we don't end up using/needing it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also forgot to mention field descriptions we discussed - it appears those are missing as well.

string path = 1; // Specifies structure-wise where this should be rendered. The interface should parse this into a tree structure and infer where it should be rendered ("/Settings/Networking/Port")
bool is_mutable = 2; // If set to true, the module itself can edit the button, and not just the user.
string description = 3; // Description of what this button does
oneof ui_elements {
Slider slider = 2;
Checkbox checkbox = 3;
Dropdown dropdown = 4;
RadioButton radiobutton = 5;
TextField textfield = 6;
Slider slider = 4;
Checkbox checkbox = 5;
Dropdown dropdown = 6;
RadioButton radiobutton = 7;
TextField textfield = 8;
}
}

message PossibleUiValue {
oneof ui_value {
UiValue default = 9;
}
message UiOptionDeclarations{
repeated UiOptionDeclaration options = 1;
}
message UiValue {
oneof value {
float float_value = 1;
bool bool_value = 2;
int64 integer_value = 3;
string text_value = 4;
}
}

message UiSettings {
message UiValues {
// maps UiOption::name to the value it currently contains.
map<string, PossibleUiValue> ui_values = 1;
map<string, UiValue> ui_values = 1;
}