From 1ec8284d7227008293d2e73553b88fe5fb74e70c Mon Sep 17 00:00:00 2001 From: Andreas Wendler Date: Tue, 27 Apr 2021 18:11:32 +0200 Subject: [PATCH] Add geometry updates to the CI protocol --- internal/app/ci/ci.go | 4 + internal/app/ci/ssl_gc_ci.pb.go | 310 ++++++++++++++++++++++---------- proto/ssl_gc_ci.proto | 3 + 3 files changed, 218 insertions(+), 99 deletions(-) diff --git a/internal/app/ci/ci.go b/internal/app/ci/ci.go index ea78c655..0c5c16e3 100644 --- a/internal/app/ci/ci.go +++ b/internal/app/ci/ci.go @@ -100,6 +100,10 @@ func (s *Server) serve(conn net.Conn) { } } + if input.Geometry != nil { + s.gcEngine.ProcessGeometry(input.Geometry) + } + if input.Timestamp != nil { sec := *input.Timestamp / 1e9 nSec := *input.Timestamp - sec*1e9 diff --git a/internal/app/ci/ssl_gc_ci.pb.go b/internal/app/ci/ssl_gc_ci.pb.go index 68a07d4d..7875e673 100644 --- a/internal/app/ci/ssl_gc_ci.pb.go +++ b/internal/app/ci/ssl_gc_ci.pb.go @@ -1,155 +1,267 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.6.1 // source: ssl_gc_ci.proto package ci import ( - fmt "fmt" api "github.com/RoboCup-SSL/ssl-game-controller/internal/app/api" state "github.com/RoboCup-SSL/ssl-game-controller/internal/app/state" tracker "github.com/RoboCup-SSL/ssl-game-controller/internal/app/tracker" - proto "github.com/golang/protobuf/proto" - math "math" + vision "github.com/RoboCup-SSL/ssl-game-controller/internal/app/vision" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) // The input format to the GC type CiInput struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // New unix timestamp in [ns] for the GC Timestamp *int64 `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"` // New tracker packet with ball and robot data TrackerPacket *tracker.TrackerWrapperPacket `protobuf:"bytes,2,opt,name=tracker_packet,json=trackerPacket" json:"tracker_packet,omitempty"` // (UI) API input - ApiInputs []*api.Input `protobuf:"bytes,3,rep,name=api_inputs,json=apiInputs" json:"api_inputs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ApiInputs []*api.Input `protobuf:"bytes,3,rep,name=api_inputs,json=apiInputs" json:"api_inputs,omitempty"` + // Update geometry + Geometry *vision.SSL_GeometryData `protobuf:"bytes,4,opt,name=geometry" json:"geometry,omitempty"` } -func (m *CiInput) Reset() { *m = CiInput{} } -func (m *CiInput) String() string { return proto.CompactTextString(m) } -func (*CiInput) ProtoMessage() {} -func (*CiInput) Descriptor() ([]byte, []int) { - return fileDescriptor_fb3c537990502ac5, []int{0} +func (x *CiInput) Reset() { + *x = CiInput{} + if protoimpl.UnsafeEnabled { + mi := &file_ssl_gc_ci_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CiInput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CiInput.Unmarshal(m, b) +func (x *CiInput) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CiInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CiInput.Marshal(b, m, deterministic) -} -func (m *CiInput) XXX_Merge(src proto.Message) { - xxx_messageInfo_CiInput.Merge(m, src) -} -func (m *CiInput) XXX_Size() int { - return xxx_messageInfo_CiInput.Size(m) -} -func (m *CiInput) XXX_DiscardUnknown() { - xxx_messageInfo_CiInput.DiscardUnknown(m) + +func (*CiInput) ProtoMessage() {} + +func (x *CiInput) ProtoReflect() protoreflect.Message { + mi := &file_ssl_gc_ci_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -var xxx_messageInfo_CiInput proto.InternalMessageInfo +// Deprecated: Use CiInput.ProtoReflect.Descriptor instead. +func (*CiInput) Descriptor() ([]byte, []int) { + return file_ssl_gc_ci_proto_rawDescGZIP(), []int{0} +} -func (m *CiInput) GetTimestamp() int64 { - if m != nil && m.Timestamp != nil { - return *m.Timestamp +func (x *CiInput) GetTimestamp() int64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp } return 0 } -func (m *CiInput) GetTrackerPacket() *tracker.TrackerWrapperPacket { - if m != nil { - return m.TrackerPacket +func (x *CiInput) GetTrackerPacket() *tracker.TrackerWrapperPacket { + if x != nil { + return x.TrackerPacket } return nil } -func (m *CiInput) GetApiInputs() []*api.Input { - if m != nil { - return m.ApiInputs +func (x *CiInput) GetApiInputs() []*api.Input { + if x != nil { + return x.ApiInputs + } + return nil +} + +func (x *CiInput) GetGeometry() *vision.SSL_GeometryData { + if x != nil { + return x.Geometry } return nil } // The output format of the GC response type CiOutput struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Latest referee message - RefereeMsg *state.Referee `protobuf:"bytes,1,opt,name=referee_msg,json=refereeMsg" json:"referee_msg,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + RefereeMsg *state.Referee `protobuf:"bytes,1,opt,name=referee_msg,json=refereeMsg" json:"referee_msg,omitempty"` } -func (m *CiOutput) Reset() { *m = CiOutput{} } -func (m *CiOutput) String() string { return proto.CompactTextString(m) } -func (*CiOutput) ProtoMessage() {} -func (*CiOutput) Descriptor() ([]byte, []int) { - return fileDescriptor_fb3c537990502ac5, []int{1} +func (x *CiOutput) Reset() { + *x = CiOutput{} + if protoimpl.UnsafeEnabled { + mi := &file_ssl_gc_ci_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *CiOutput) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CiOutput.Unmarshal(m, b) +func (x *CiOutput) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *CiOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CiOutput.Marshal(b, m, deterministic) + +func (*CiOutput) ProtoMessage() {} + +func (x *CiOutput) ProtoReflect() protoreflect.Message { + mi := &file_ssl_gc_ci_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *CiOutput) XXX_Merge(src proto.Message) { - xxx_messageInfo_CiOutput.Merge(m, src) + +// Deprecated: Use CiOutput.ProtoReflect.Descriptor instead. +func (*CiOutput) Descriptor() ([]byte, []int) { + return file_ssl_gc_ci_proto_rawDescGZIP(), []int{1} } -func (m *CiOutput) XXX_Size() int { - return xxx_messageInfo_CiOutput.Size(m) + +func (x *CiOutput) GetRefereeMsg() *state.Referee { + if x != nil { + return x.RefereeMsg + } + return nil } -func (m *CiOutput) XXX_DiscardUnknown() { - xxx_messageInfo_CiOutput.DiscardUnknown(m) + +var File_ssl_gc_ci_proto protoreflect.FileDescriptor + +var file_ssl_gc_ci_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x73, 0x73, 0x6c, 0x5f, 0x67, 0x63, 0x5f, 0x63, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x20, 0x73, 0x73, 0x6c, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x77, 0x72, + 0x61, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x10, 0x73, 0x73, 0x6c, 0x5f, 0x67, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x73, 0x73, 0x6c, 0x5f, 0x67, 0x63, 0x5f, 0x72, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x65, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x73, 0x73, 0x6c, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbb, + 0x01, 0x0a, 0x07, 0x43, 0x69, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x3c, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x63, + 0x6b, 0x65, 0x72, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x15, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, + 0x72, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, + 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x25, 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x5f, 0x69, 0x6e, + 0x70, 0x75, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x49, 0x6e, 0x70, + 0x75, 0x74, 0x52, 0x09, 0x61, 0x70, 0x69, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x12, 0x2d, 0x0a, + 0x08, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x11, 0x2e, 0x53, 0x53, 0x4c, 0x5f, 0x47, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x44, 0x61, + 0x74, 0x61, 0x52, 0x08, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x22, 0x35, 0x0a, 0x08, + 0x43, 0x69, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x29, 0x0a, 0x0b, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x65, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x65, 0x52, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x65, + 0x4d, 0x73, 0x67, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x52, 0x6f, 0x62, 0x6f, 0x43, 0x75, 0x70, 0x2d, 0x53, 0x53, 0x4c, 0x2f, 0x73, 0x73, + 0x6c, 0x2d, 0x67, 0x61, 0x6d, 0x65, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x63, + 0x69, } -var xxx_messageInfo_CiOutput proto.InternalMessageInfo +var ( + file_ssl_gc_ci_proto_rawDescOnce sync.Once + file_ssl_gc_ci_proto_rawDescData = file_ssl_gc_ci_proto_rawDesc +) -func (m *CiOutput) GetRefereeMsg() *state.Referee { - if m != nil { - return m.RefereeMsg - } - return nil +func file_ssl_gc_ci_proto_rawDescGZIP() []byte { + file_ssl_gc_ci_proto_rawDescOnce.Do(func() { + file_ssl_gc_ci_proto_rawDescData = protoimpl.X.CompressGZIP(file_ssl_gc_ci_proto_rawDescData) + }) + return file_ssl_gc_ci_proto_rawDescData } -func init() { - proto.RegisterType((*CiInput)(nil), "CiInput") - proto.RegisterType((*CiOutput)(nil), "CiOutput") -} - -func init() { - proto.RegisterFile("ssl_gc_ci.proto", fileDescriptor_fb3c537990502ac5) -} - -var fileDescriptor_fb3c537990502ac5 = []byte{ - // 274 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x8e, 0x4d, 0x4b, 0xf4, 0x30, - 0x14, 0x85, 0xe9, 0x3b, 0xf0, 0x3a, 0x93, 0xe2, 0x07, 0x05, 0xa1, 0xc8, 0x2c, 0xca, 0x80, 0x50, - 0x17, 0x6d, 0xa1, 0xe0, 0x46, 0x66, 0x65, 0x57, 0x82, 0xa2, 0x64, 0x04, 0xc1, 0x4d, 0xc8, 0xc4, - 0x6b, 0x0c, 0xb6,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 0x60, 0xb1, 0xdb, 0xdd, 0x56, 0x44, 0x6d, - 0xa1, 0x65, 0x07, 0x85, 0xb2, 0xbd, 0x77, 0xb6, 0x6d, 0xc1, 0x55, 0xa6, 0xf7, 0xe0, 0x7a, 0xd9, - 0x56, 0x12, 0xb1, 0x52, 0xe6, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x3c, 0xb7, 0xc6, 0x21, 0x67, 0x01, - 0x00, 0x00, +var file_ssl_gc_ci_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_ssl_gc_ci_proto_goTypes = []interface{}{ + (*CiInput)(nil), // 0: CiInput + (*CiOutput)(nil), // 1: CiOutput + (*tracker.TrackerWrapperPacket)(nil), // 2: TrackerWrapperPacket + (*api.Input)(nil), // 3: Input + (*vision.SSL_GeometryData)(nil), // 4: SSL_GeometryData + (*state.Referee)(nil), // 5: Referee +} +var file_ssl_gc_ci_proto_depIdxs = []int32{ + 2, // 0: CiInput.tracker_packet:type_name -> TrackerWrapperPacket + 3, // 1: CiInput.api_inputs:type_name -> Input + 4, // 2: CiInput.geometry:type_name -> SSL_GeometryData + 5, // 3: CiOutput.referee_msg:type_name -> Referee + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_ssl_gc_ci_proto_init() } +func file_ssl_gc_ci_proto_init() { + if File_ssl_gc_ci_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ssl_gc_ci_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CiInput); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ssl_gc_ci_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CiOutput); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ssl_gc_ci_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ssl_gc_ci_proto_goTypes, + DependencyIndexes: file_ssl_gc_ci_proto_depIdxs, + MessageInfos: file_ssl_gc_ci_proto_msgTypes, + }.Build() + File_ssl_gc_ci_proto = out.File + file_ssl_gc_ci_proto_rawDesc = nil + file_ssl_gc_ci_proto_goTypes = nil + file_ssl_gc_ci_proto_depIdxs = nil } diff --git a/proto/ssl_gc_ci.proto b/proto/ssl_gc_ci.proto index 9b9ed056..0eddc734 100644 --- a/proto/ssl_gc_ci.proto +++ b/proto/ssl_gc_ci.proto @@ -5,6 +5,7 @@ option go_package = "github.com/RoboCup-SSL/ssl-game-controller/internal/app/ci" import "ssl_vision_wrapper_tracked.proto"; import "ssl_gc_api.proto"; import "ssl_gc_referee_message.proto"; +import "ssl_vision_geometry.proto"; // The input format to the GC message CiInput { @@ -14,6 +15,8 @@ message CiInput { optional TrackerWrapperPacket tracker_packet = 2; // (UI) API input repeated Input api_inputs = 3; + // Update geometry + optional SSL_GeometryData geometry = 4; } // The output format of the GC response