diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..bc77854 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 + +[*.go] +indent_style = tab diff --git a/cmd/ssl-vision-client/main.go b/cmd/ssl-vision-client/main.go index c47b8d2..c2bf6bc 100644 --- a/cmd/ssl-vision-client/main.go +++ b/cmd/ssl-vision-client/main.go @@ -3,6 +3,7 @@ package main import ( "flag" "github.com/RoboCup-SSL/ssl-vision-client/pkg/client" + "github.com/RoboCup-SSL/ssl-vision-client/pkg/tracked" "github.com/RoboCup-SSL/ssl-vision-client/pkg/vision" "github.com/RoboCup-SSL/ssl-vision-client/pkg/visualization" "github.com/gobuffalo/packr" @@ -13,6 +14,7 @@ import ( var address = flag.String("address", ":8082", "The address on which the UI and API is served, default: :8082") var visionAddress = flag.String("visionAddress", "224.5.23.2:10006", "The multicast address of ssl-vision, default: 224.5.23.2:10006") +var trackedAddress = flag.String("trackedAddress", "224.5.23.2:10010", "The multicast address of trackers, default: 224.5.23.2:10010") var visualizationAddress = flag.String("visualizationAddress", "224.5.23.2:10011", "The multicast address of visualization frames, default: 224.5.23.2:10011") var skipInterfaces = flag.String("skipInterfaces", "", "Comma separated list of interface names to ignore when receiving multicast packets") var verbose = flag.Bool("verbose", false, "Verbose output") @@ -31,8 +33,10 @@ func main() { func setupVisionClient() { receiver := vision.NewReceiver() visualizationReceiver := visualization.NewReceiver() + trackedReceiver := tracked.NewReceiver() publisher := client.NewPublisher() publisher.DetectionProvider = receiver.CombinedDetectionFrames + publisher.TrackerProvider = trackedReceiver.TrackedFrames publisher.GeometryProvider = geometryProvider(receiver) publisher.LineSegmentProvider = visualizationReceiver.GetLineSegments publisher.CircleProvider = visualizationReceiver.GetCircles @@ -43,9 +47,12 @@ func setupVisionClient() { receiver.MulticastServer.Verbose = *verbose visualizationReceiver.MulticastServer.SkipInterfaces = skipIfis visualizationReceiver.MulticastServer.Verbose = *verbose + trackedReceiver.MulticastServer.SkipInterfaces = skipIfis + trackedReceiver.MulticastServer.Verbose = *verbose receiver.Start(*visionAddress) visualizationReceiver.Start(*visualizationAddress) + trackedReceiver.Start(*trackedAddress) } func geometryProvider(receiver *vision.Receiver) func() *vision.SSL_GeometryData { diff --git a/go.mod b/go.mod index f724db7..4dee822 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.13 require ( github.com/gobuffalo/packr v1.30.1 - github.com/golang/protobuf v1.4.3 + github.com/golang/protobuf v1.5.2 github.com/gorilla/websocket v1.4.1 - google.golang.org/protobuf v1.25.0 + google.golang.org/protobuf v1.26.0 ) diff --git a/go.sum b/go.sum index 3d1f2a6..fd189e4 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,5 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -10,49 +7,28 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU= github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/logger v1.0.0 h1:xw9Ko9EcC5iAFprrjJ6oZco9UpzS5MQ4jAwghsLHdy4= github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4= github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg= github.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk= -github.com/gobuffalo/packr/v2 v2.5.1 h1:TFOeY2VoGamPjQLiNDT3mn//ytzk236VMO2j7iHxJR4= github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= -github.com/karrick/godirwalk v1.10.12 h1:BqUm+LuJcXjGv1d2mj3gBiQyrQ57a0rYoAmhvJQ7RDU= github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -63,19 +39,15 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -87,58 +59,23 @@ github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljT github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 h1:ydJNl0ENAG67pFbB+9tfhiL2pYqLhfoaZFw/cjLhY4A= golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190515120540-06a5c4944438 h1:khxRGsvPk4n2y8I/mLLjp7e5dMTJmH75wvqS6nMwUtY= golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/client/api.go b/pkg/client/api.go index 01b83d6..f13b6c3 100644 --- a/pkg/client/api.go +++ b/pkg/client/api.go @@ -1,12 +1,18 @@ package client +type Request struct { + ActiveSourceId string `json:"activeSourceId"` +} + type Package struct { - FieldWidth float32 `json:"fieldWidth"` - FieldLength float32 `json:"fieldLength"` - BoundaryWidth float32 `json:"boundaryWidth"` - GoalWidth float32 `json:"goalWidth"` - GoalDepth float32 `json:"goalDepth"` - Shapes []Shape `json:"shapes"` + FieldWidth float32 `json:"fieldWidth"` + FieldLength float32 `json:"fieldLength"` + BoundaryWidth float32 `json:"boundaryWidth"` + GoalWidth float32 `json:"goalWidth"` + GoalDepth float32 `json:"goalDepth"` + Shapes []Shape `json:"shapes"` + ActiveSourceId string `json:"activeSourceId"` + Sources map[string]string `json:"sources"` } type Shape struct { diff --git a/pkg/client/converter.go b/pkg/client/converter.go index 65f53f8..ef276e5 100644 --- a/pkg/client/converter.go +++ b/pkg/client/converter.go @@ -2,8 +2,10 @@ package client import ( "fmt" + "github.com/RoboCup-SSL/ssl-vision-client/pkg/tracked" "github.com/RoboCup-SSL/ssl-vision-client/pkg/vision" "github.com/RoboCup-SSL/ssl-vision-client/pkg/visualization" + "math" "sort" "strconv" ) @@ -29,24 +31,48 @@ func (a ShapesByOrderNumber) Less(i, j int) bool { return a[i].OrderNumber < a[j func (p *Package) AddDetectionFrame(frame *vision.SSL_DetectionFrame) { for _, ball := range frame.Balls { - p.Shapes = append(p.Shapes, Shape{OrderNumber: 3, Circle: createBallShape(ball)}) + p.Shapes = append(p.Shapes, Shape{OrderNumber: 3, Circle: createBallShape(*ball.X, *ball.Y, 0)}) } for _, bot := range frame.RobotsBlue { - p.Shapes = append(p.Shapes, Shape{OrderNumber: 1, Path: createBotPath(bot, blue)}) - p.Shapes = append(p.Shapes, Shape{OrderNumber: 2, Text: createBotId(bot, white)}) + p.Shapes = append(p.Shapes, Shape{OrderNumber: 1, Path: createBotPath(*bot.X, *bot.Y, *bot.Orientation, blue)}) + p.Shapes = append(p.Shapes, Shape{OrderNumber: 2, Text: createBotId(*bot.RobotId, *bot.X, *bot.Y, white)}) } for _, bot := range frame.RobotsYellow { - p.Shapes = append(p.Shapes, Shape{OrderNumber: 1, Path: createBotPath(bot, yellow)}) - p.Shapes = append(p.Shapes, Shape{OrderNumber: 2, Text: createBotId(bot, black)}) + p.Shapes = append(p.Shapes, Shape{OrderNumber: 1, Path: createBotPath(*bot.X, *bot.Y, *bot.Orientation, yellow)}) + p.Shapes = append(p.Shapes, Shape{OrderNumber: 2, Text: createBotId(*bot.RobotId, *bot.X, *bot.Y, black)}) } } -func createBallShape(ball *vision.SSL_DetectionBall) *Circle { +func (p *Package) AddTrackedFrame(frame *tracked.TrackerWrapperPacket) { + if frame.TrackedFrame == nil { + return + } + for _, ball := range frame.TrackedFrame.Balls { + p.Shapes = append(p.Shapes, Shape{OrderNumber: 3, Circle: createBallShape(*ball.Pos.X*1000, *ball.Pos.Y*1000, *ball.Pos.Z*1000)}) + } + + for _, bot := range frame.TrackedFrame.Robots { + var botColor string + var strokeColor string + if *bot.RobotId.Team == tracked.Team_YELLOW { + botColor = yellow + strokeColor = black + } else { + botColor = blue + strokeColor = white + } + p.Shapes = append(p.Shapes, Shape{OrderNumber: 1, Path: createBotPath(*bot.Pos.X*1000, *bot.Pos.Y*1000, *bot.Orientation, botColor)}) + p.Shapes = append(p.Shapes, Shape{OrderNumber: 2, Text: createBotId(*bot.RobotId.Id, *bot.Pos.X*1000, *bot.Pos.Y*1000, strokeColor)}) + } +} + +func createBallShape(x, y, z float32) *Circle { + heightFactor := 0.01*math.Abs(float64(z)) + 1 return &Circle{ - Center: Point{*ball.X, -*ball.Y}, - Radius: ballRadius, + Center: Point{x, -y}, + Radius: float32(heightFactor) * ballRadius, Style: Style{ StrokeWidth: &ballStrokeWidth, Fill: &orange, @@ -112,11 +138,11 @@ func goalLinesPositive(geometry *vision.SSL_GeometryData) (lines []Shape) { return } -func createBotPath(bot *vision.SSL_DetectionRobot, fillColor string) *Path { +func createBotPath(posX, posY, orientation float32, fillColor string) *Path { b := Bot{center2Dribbler, botRadius} - x := float64(*bot.X) - y := -float64(*bot.Y) - o := float64(*bot.Orientation) + x := float64(posX) + y := -float64(posY) + o := float64(orientation) return &Path{ D: []PathElement{ {Type: "M", @@ -149,10 +175,10 @@ func createBotPath(bot *vision.SSL_DetectionRobot, fillColor string) *Path { } } -func createBotId(bot *vision.SSL_DetectionRobot, strokeColor string) *Text { +func createBotId(id uint32, x, y float32, strokeColor string) *Text { return &Text{ - Text: strconv.Itoa(int(*bot.RobotId)), - P: Point{*bot.X, -*bot.Y}, + Text: strconv.Itoa(int(id)), + P: Point{x, -y}, Style: Style{ Fill: &strokeColor, }, diff --git a/pkg/client/publisher.go b/pkg/client/publisher.go index 44706a4..ee79f80 100644 --- a/pkg/client/publisher.go +++ b/pkg/client/publisher.go @@ -2,19 +2,25 @@ package client import ( "encoding/json" + "github.com/RoboCup-SSL/ssl-vision-client/pkg/tracked" "github.com/RoboCup-SSL/ssl-vision-client/pkg/vision" "github.com/RoboCup-SSL/ssl-vision-client/pkg/visualization" "github.com/gorilla/websocket" "log" "net/http" + "sync" "time" ) const publishDt = 50 * time.Millisecond +const visionSource = "vision" + +type PublishType int type Publisher struct { upgrader websocket.Upgrader DetectionProvider func() *vision.SSL_DetectionFrame + TrackerProvider func() map[string]*tracked.TrackerWrapperPacket GeometryProvider func() *vision.SSL_GeometryData LineSegmentProvider func() map[string][]*visualization.LineSegment CircleProvider func() map[string][]*visualization.Circle @@ -29,6 +35,12 @@ func NewPublisher() (p Publisher) { return p } +type PublisherClient struct { + conn *websocket.Conn + activeTrackedSource string + mutex sync.Mutex +} + func (p *Publisher) Handler(w http.ResponseWriter, r *http.Request) { conn, err := p.upgrader.Upgrade(w, r, nil) if err != nil { @@ -44,13 +56,37 @@ func (p *Publisher) Handler(w http.ResponseWriter, r *http.Request) { log.Println("Client connected") + client := &PublisherClient{} + client.conn = conn + client.activeTrackedSource = r.URL.Query().Get("sourceId") + go client.handleClientRequests() + for { pack := new(Package) - detectionFrame := p.DetectionProvider() - pack.AddDetectionFrame(detectionFrame) + trackedFrames := p.TrackerProvider() + client.mutex.Lock() + client.activeTrackedSource = selectSourceId(trackedFrames, client.activeTrackedSource) + + if client.activeTrackedSource == visionSource { + detectionFrame := p.DetectionProvider() + pack.AddDetectionFrame(detectionFrame) + } else { + if frame, ok := trackedFrames[client.activeTrackedSource]; ok { + pack.AddTrackedFrame(frame) + } + } + pack.ActiveSourceId = client.activeTrackedSource + client.mutex.Unlock() + geometry := p.GeometryProvider() pack.AddGeometryShapes(geometry) + pack.Sources = map[string]string{} + pack.Sources[visionSource] = visionSource + for _, frame := range trackedFrames { + pack.Sources[*frame.Uuid] = *frame.SourceName + } + p.addVisualization(pack) payload, err := json.Marshal(*pack) @@ -67,6 +103,41 @@ func (p *Publisher) Handler(w http.ResponseWriter, r *http.Request) { } } +func (p *PublisherClient) handleClientRequests() { + for { + messageType, data, err := p.conn.ReadMessage() + if err != nil { + log.Println("Could not read message: ", err) + return + } + if messageType == websocket.TextMessage { + var request Request + if err := json.Unmarshal(data, &request); err != nil { + log.Println("Could not deserialize message: ", string(data)) + } else { + p.mutex.Lock() + p.activeTrackedSource = request.ActiveSourceId + p.mutex.Unlock() + } + } else { + log.Println("Got non-text message") + } + } +} + +func selectSourceId(trackedFrames map[string]*tracked.TrackerWrapperPacket, activeSourceId string) string { + if activeSourceId == visionSource { + return activeSourceId + } + if _, ok := trackedFrames[activeSourceId]; ok { + return activeSourceId + } + for k := range trackedFrames { + return k + } + return visionSource +} + func (p *Publisher) addVisualization(pack *Package) { allLineSegments := p.LineSegmentProvider() diff --git a/pkg/tracked/receiver.go b/pkg/tracked/receiver.go new file mode 100644 index 0000000..9ecfa01 --- /dev/null +++ b/pkg/tracked/receiver.go @@ -0,0 +1,71 @@ +package tracked + +import ( + "github.com/RoboCup-SSL/ssl-vision-client/pkg/sslnet" + "github.com/golang/protobuf/proto" + "log" + "sync" + "time" +) + +type Receiver struct { + frames map[string]*TrackerWrapperPacket + receivedTimes map[string]time.Time + mutex sync.Mutex + MulticastServer *sslnet.MulticastServer + ConsumeDetections func(frame *TrackerWrapperPacket) +} + +func NewReceiver() (r *Receiver) { + r = new(Receiver) + r.frames = map[string]*TrackerWrapperPacket{} + r.receivedTimes = map[string]time.Time{} + r.MulticastServer = sslnet.NewMulticastServer(r.consumeMessage) + r.ConsumeDetections = func(*TrackerWrapperPacket) {} + return +} + +func (r *Receiver) Start(multicastAddress string) { + r.MulticastServer.Start(multicastAddress) +} + +func (r *Receiver) TrackedFrames() map[string]*TrackerWrapperPacket { + r.mutex.Lock() + defer r.mutex.Unlock() + + frames := map[string]*TrackerWrapperPacket{} + for k, v := range r.frames { + frames[k] = v + } + return frames +} + +func (r *Receiver) consumeMessage(data []byte) { + message, err := parseVisionWrapperPacket(data) + if err != nil { + log.Print("Could not parse message: ", err) + return + } + r.mutex.Lock() + if message.Uuid != nil && message.TrackedFrame != nil { + r.frames[*message.Uuid] = message + r.receivedTimes[*message.Uuid] = time.Now() + r.ConsumeDetections(message) + } + r.mutex.Unlock() +} + +func parseVisionWrapperPacket(data []byte) (message *TrackerWrapperPacket, err error) { + message = new(TrackerWrapperPacket) + err = proto.Unmarshal(data, message) + return +} + +func (r *Receiver) cleanupDetections() { + for camId, t := range r.receivedTimes { + if time.Now().Sub(t) > time.Second { + delete(r.receivedTimes, camId) + delete(r.frames, camId) + } + } +} diff --git a/pkg/tracked/ssl_gc_common.pb.go b/pkg/tracked/ssl_gc_common.pb.go new file mode 100644 index 0000000..db2e80d --- /dev/null +++ b/pkg/tracked/ssl_gc_common.pb.go @@ -0,0 +1,290 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.15.7 +// source: ssl_gc_common.proto + +package tracked + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// Team is either blue or yellow +type Team int32 + +const ( + // team not set + Team_UNKNOWN Team = 0 + // yellow team + Team_YELLOW Team = 1 + // blue team + Team_BLUE Team = 2 +) + +// Enum value maps for Team. +var ( + Team_name = map[int32]string{ + 0: "UNKNOWN", + 1: "YELLOW", + 2: "BLUE", + } + Team_value = map[string]int32{ + "UNKNOWN": 0, + "YELLOW": 1, + "BLUE": 2, + } +) + +func (x Team) Enum() *Team { + p := new(Team) + *p = x + return p +} + +func (x Team) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Team) Descriptor() protoreflect.EnumDescriptor { + return file_ssl_gc_common_proto_enumTypes[0].Descriptor() +} + +func (Team) Type() protoreflect.EnumType { + return &file_ssl_gc_common_proto_enumTypes[0] +} + +func (x Team) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *Team) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = Team(num) + return nil +} + +// Deprecated: Use Team.Descriptor instead. +func (Team) EnumDescriptor() ([]byte, []int) { + return file_ssl_gc_common_proto_rawDescGZIP(), []int{0} +} + +// Division denotes the current division, which influences some rules +type Division int32 + +const ( + Division_DIV_UNKNOWN Division = 0 + Division_DIV_A Division = 1 + Division_DIV_B Division = 2 +) + +// Enum value maps for Division. +var ( + Division_name = map[int32]string{ + 0: "DIV_UNKNOWN", + 1: "DIV_A", + 2: "DIV_B", + } + Division_value = map[string]int32{ + "DIV_UNKNOWN": 0, + "DIV_A": 1, + "DIV_B": 2, + } +) + +func (x Division) Enum() *Division { + p := new(Division) + *p = x + return p +} + +func (x Division) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Division) Descriptor() protoreflect.EnumDescriptor { + return file_ssl_gc_common_proto_enumTypes[1].Descriptor() +} + +func (Division) Type() protoreflect.EnumType { + return &file_ssl_gc_common_proto_enumTypes[1] +} + +func (x Division) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *Division) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = Division(num) + return nil +} + +// Deprecated: Use Division.Descriptor instead. +func (Division) EnumDescriptor() ([]byte, []int) { + return file_ssl_gc_common_proto_rawDescGZIP(), []int{1} +} + +// RobotId is the combination of a team and a robot id +type RobotId struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // the robot number + Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + // the team that the robot belongs to + Team *Team `protobuf:"varint,2,opt,name=team,enum=Team" json:"team,omitempty"` +} + +func (x *RobotId) Reset() { + *x = RobotId{} + if protoimpl.UnsafeEnabled { + mi := &file_ssl_gc_common_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RobotId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RobotId) ProtoMessage() {} + +func (x *RobotId) ProtoReflect() protoreflect.Message { + mi := &file_ssl_gc_common_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) +} + +// Deprecated: Use RobotId.ProtoReflect.Descriptor instead. +func (*RobotId) Descriptor() ([]byte, []int) { + return file_ssl_gc_common_proto_rawDescGZIP(), []int{0} +} + +func (x *RobotId) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *RobotId) GetTeam() Team { + if x != nil && x.Team != nil { + return *x.Team + } + return Team_UNKNOWN +} + +var File_ssl_gc_common_proto protoreflect.FileDescriptor + +var file_ssl_gc_common_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x73, 0x73, 0x6c, 0x5f, 0x67, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x07, 0x52, 0x6f, 0x62, 0x6f, 0x74, 0x49, 0x64, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x19, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x05, + 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x2a, 0x29, 0x0a, 0x04, 0x54, + 0x65, 0x61, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, + 0x12, 0x0a, 0x0a, 0x06, 0x59, 0x45, 0x4c, 0x4c, 0x4f, 0x57, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, + 0x42, 0x4c, 0x55, 0x45, 0x10, 0x02, 0x2a, 0x31, 0x0a, 0x08, 0x44, 0x69, 0x76, 0x69, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x49, 0x56, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, + 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x49, 0x56, 0x5f, 0x41, 0x10, 0x01, 0x12, 0x09, + 0x0a, 0x05, 0x44, 0x49, 0x56, 0x5f, 0x42, 0x10, 0x02, 0x42, 0x36, 0x5a, 0x34, 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, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2d, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, + 0x64, +} + +var ( + file_ssl_gc_common_proto_rawDescOnce sync.Once + file_ssl_gc_common_proto_rawDescData = file_ssl_gc_common_proto_rawDesc +) + +func file_ssl_gc_common_proto_rawDescGZIP() []byte { + file_ssl_gc_common_proto_rawDescOnce.Do(func() { + file_ssl_gc_common_proto_rawDescData = protoimpl.X.CompressGZIP(file_ssl_gc_common_proto_rawDescData) + }) + return file_ssl_gc_common_proto_rawDescData +} + +var file_ssl_gc_common_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_ssl_gc_common_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_ssl_gc_common_proto_goTypes = []interface{}{ + (Team)(0), // 0: Team + (Division)(0), // 1: Division + (*RobotId)(nil), // 2: RobotId +} +var file_ssl_gc_common_proto_depIdxs = []int32{ + 0, // 0: RobotId.team:type_name -> Team + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_ssl_gc_common_proto_init() } +func file_ssl_gc_common_proto_init() { + if File_ssl_gc_common_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ssl_gc_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RobotId); 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_common_proto_rawDesc, + NumEnums: 2, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ssl_gc_common_proto_goTypes, + DependencyIndexes: file_ssl_gc_common_proto_depIdxs, + EnumInfos: file_ssl_gc_common_proto_enumTypes, + MessageInfos: file_ssl_gc_common_proto_msgTypes, + }.Build() + File_ssl_gc_common_proto = out.File + file_ssl_gc_common_proto_rawDesc = nil + file_ssl_gc_common_proto_goTypes = nil + file_ssl_gc_common_proto_depIdxs = nil +} diff --git a/pkg/tracked/ssl_gc_geometry.pb.go b/pkg/tracked/ssl_gc_geometry.pb.go new file mode 100644 index 0000000..66b1a5a --- /dev/null +++ b/pkg/tracked/ssl_gc_geometry.pb.go @@ -0,0 +1,233 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.15.7 +// source: ssl_gc_geometry.proto + +package tracked + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// A vector with two dimensions +type Vector2 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + X *float32 `protobuf:"fixed32,1,req,name=x" json:"x,omitempty"` + Y *float32 `protobuf:"fixed32,2,req,name=y" json:"y,omitempty"` +} + +func (x *Vector2) Reset() { + *x = Vector2{} + if protoimpl.UnsafeEnabled { + mi := &file_ssl_gc_geometry_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Vector2) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Vector2) ProtoMessage() {} + +func (x *Vector2) ProtoReflect() protoreflect.Message { + mi := &file_ssl_gc_geometry_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) +} + +// Deprecated: Use Vector2.ProtoReflect.Descriptor instead. +func (*Vector2) Descriptor() ([]byte, []int) { + return file_ssl_gc_geometry_proto_rawDescGZIP(), []int{0} +} + +func (x *Vector2) GetX() float32 { + if x != nil && x.X != nil { + return *x.X + } + return 0 +} + +func (x *Vector2) GetY() float32 { + if x != nil && x.Y != nil { + return *x.Y + } + return 0 +} + +// A vector with three dimensions +type Vector3 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + X *float32 `protobuf:"fixed32,1,req,name=x" json:"x,omitempty"` + Y *float32 `protobuf:"fixed32,2,req,name=y" json:"y,omitempty"` + Z *float32 `protobuf:"fixed32,3,req,name=z" json:"z,omitempty"` +} + +func (x *Vector3) Reset() { + *x = Vector3{} + if protoimpl.UnsafeEnabled { + mi := &file_ssl_gc_geometry_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Vector3) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Vector3) ProtoMessage() {} + +func (x *Vector3) ProtoReflect() protoreflect.Message { + mi := &file_ssl_gc_geometry_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) +} + +// Deprecated: Use Vector3.ProtoReflect.Descriptor instead. +func (*Vector3) Descriptor() ([]byte, []int) { + return file_ssl_gc_geometry_proto_rawDescGZIP(), []int{1} +} + +func (x *Vector3) GetX() float32 { + if x != nil && x.X != nil { + return *x.X + } + return 0 +} + +func (x *Vector3) GetY() float32 { + if x != nil && x.Y != nil { + return *x.Y + } + return 0 +} + +func (x *Vector3) GetZ() float32 { + if x != nil && x.Z != nil { + return *x.Z + } + return 0 +} + +var File_ssl_gc_geometry_proto protoreflect.FileDescriptor + +var file_ssl_gc_geometry_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x73, 0x73, 0x6c, 0x5f, 0x67, 0x63, 0x5f, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, + 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x25, 0x0a, 0x07, 0x56, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x32, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x02, 0x28, 0x02, 0x52, 0x01, 0x78, + 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x02, 0x28, 0x02, 0x52, 0x01, 0x79, 0x22, 0x33, + 0x0a, 0x07, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x33, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, + 0x20, 0x02, 0x28, 0x02, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x02, + 0x28, 0x02, 0x52, 0x01, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x7a, 0x18, 0x03, 0x20, 0x02, 0x28, 0x02, + 0x52, 0x01, 0x7a, 0x42, 0x36, 0x5a, 0x34, 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, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, +} + +var ( + file_ssl_gc_geometry_proto_rawDescOnce sync.Once + file_ssl_gc_geometry_proto_rawDescData = file_ssl_gc_geometry_proto_rawDesc +) + +func file_ssl_gc_geometry_proto_rawDescGZIP() []byte { + file_ssl_gc_geometry_proto_rawDescOnce.Do(func() { + file_ssl_gc_geometry_proto_rawDescData = protoimpl.X.CompressGZIP(file_ssl_gc_geometry_proto_rawDescData) + }) + return file_ssl_gc_geometry_proto_rawDescData +} + +var file_ssl_gc_geometry_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_ssl_gc_geometry_proto_goTypes = []interface{}{ + (*Vector2)(nil), // 0: Vector2 + (*Vector3)(nil), // 1: Vector3 +} +var file_ssl_gc_geometry_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ssl_gc_geometry_proto_init() } +func file_ssl_gc_geometry_proto_init() { + if File_ssl_gc_geometry_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_ssl_gc_geometry_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Vector2); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ssl_gc_geometry_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Vector3); 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_geometry_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ssl_gc_geometry_proto_goTypes, + DependencyIndexes: file_ssl_gc_geometry_proto_depIdxs, + MessageInfos: file_ssl_gc_geometry_proto_msgTypes, + }.Build() + File_ssl_gc_geometry_proto = out.File + file_ssl_gc_geometry_proto_rawDesc = nil + file_ssl_gc_geometry_proto_goTypes = nil + file_ssl_gc_geometry_proto_depIdxs = nil +} diff --git a/pkg/tracked/ssl_vision_detection_tracked.pb.go b/pkg/tracked/ssl_vision_detection_tracked.pb.go new file mode 100644 index 0000000..a8d9a9b --- /dev/null +++ b/pkg/tracked/ssl_vision_detection_tracked.pb.go @@ -0,0 +1,636 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.15.7 +// source: ssl_vision_detection_tracked.proto + +package tracked + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// Capabilities that a source implementation can have +type Capability int32 + +const ( + Capability_CAPABILITY_UNKNOWN Capability = 0 + Capability_CAPABILITY_DETECT_FLYING_BALLS Capability = 1 + Capability_CAPABILITY_DETECT_MULTIPLE_BALLS Capability = 2 + Capability_CAPABILITY_DETECT_KICKED_BALLS Capability = 3 +) + +// Enum value maps for Capability. +var ( + Capability_name = map[int32]string{ + 0: "CAPABILITY_UNKNOWN", + 1: "CAPABILITY_DETECT_FLYING_BALLS", + 2: "CAPABILITY_DETECT_MULTIPLE_BALLS", + 3: "CAPABILITY_DETECT_KICKED_BALLS", + } + Capability_value = map[string]int32{ + "CAPABILITY_UNKNOWN": 0, + "CAPABILITY_DETECT_FLYING_BALLS": 1, + "CAPABILITY_DETECT_MULTIPLE_BALLS": 2, + "CAPABILITY_DETECT_KICKED_BALLS": 3, + } +) + +func (x Capability) Enum() *Capability { + p := new(Capability) + *p = x + return p +} + +func (x Capability) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Capability) Descriptor() protoreflect.EnumDescriptor { + return file_ssl_vision_detection_tracked_proto_enumTypes[0].Descriptor() +} + +func (Capability) Type() protoreflect.EnumType { + return &file_ssl_vision_detection_tracked_proto_enumTypes[0] +} + +func (x Capability) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *Capability) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = Capability(num) + return nil +} + +// Deprecated: Use Capability.Descriptor instead. +func (Capability) EnumDescriptor() ([]byte, []int) { + return file_ssl_vision_detection_tracked_proto_rawDescGZIP(), []int{0} +} + +// A single tracked ball +type TrackedBall struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The position (x, y, height) [m] in the ssl-vision coordinate system + Pos *Vector3 `protobuf:"bytes,1,req,name=pos" json:"pos,omitempty"` + // The velocity [m/s] in the ssl-vision coordinate system + Vel *Vector3 `protobuf:"bytes,2,opt,name=vel" json:"vel,omitempty"` + // The visibility of the ball + // A value between 0 (not visible) and 1 (visible) + // The exact implementation depends on the source software + Visibility *float32 `protobuf:"fixed32,3,opt,name=visibility" json:"visibility,omitempty"` +} + +func (x *TrackedBall) Reset() { + *x = TrackedBall{} + if protoimpl.UnsafeEnabled { + mi := &file_ssl_vision_detection_tracked_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TrackedBall) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackedBall) ProtoMessage() {} + +func (x *TrackedBall) ProtoReflect() protoreflect.Message { + mi := &file_ssl_vision_detection_tracked_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) +} + +// Deprecated: Use TrackedBall.ProtoReflect.Descriptor instead. +func (*TrackedBall) Descriptor() ([]byte, []int) { + return file_ssl_vision_detection_tracked_proto_rawDescGZIP(), []int{0} +} + +func (x *TrackedBall) GetPos() *Vector3 { + if x != nil { + return x.Pos + } + return nil +} + +func (x *TrackedBall) GetVel() *Vector3 { + if x != nil { + return x.Vel + } + return nil +} + +func (x *TrackedBall) GetVisibility() float32 { + if x != nil && x.Visibility != nil { + return *x.Visibility + } + return 0 +} + +// A ball kicked by a robot, including predictions when the ball will come to a stop +type KickedBall struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The initial position [m] from which the ball was kicked + Pos *Vector2 `protobuf:"bytes,1,req,name=pos" json:"pos,omitempty"` + // The initial velocity [m/s] with which the ball was kicked + Vel *Vector3 `protobuf:"bytes,2,req,name=vel" json:"vel,omitempty"` + // The unix timestamp [s] when the kick was performed + StartTimestamp *float64 `protobuf:"fixed64,3,req,name=start_timestamp,json=startTimestamp" json:"start_timestamp,omitempty"` + // The predicted unix timestamp [s] when the ball comes to a stop + StopTimestamp *float64 `protobuf:"fixed64,4,opt,name=stop_timestamp,json=stopTimestamp" json:"stop_timestamp,omitempty"` + // The predicted position [m] at which the ball will come to a stop + StopPos *Vector2 `protobuf:"bytes,5,opt,name=stop_pos,json=stopPos" json:"stop_pos,omitempty"` + // The robot that kicked the ball + RobotId *RobotId `protobuf:"bytes,6,opt,name=robot_id,json=robotId" json:"robot_id,omitempty"` +} + +func (x *KickedBall) Reset() { + *x = KickedBall{} + if protoimpl.UnsafeEnabled { + mi := &file_ssl_vision_detection_tracked_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KickedBall) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KickedBall) ProtoMessage() {} + +func (x *KickedBall) ProtoReflect() protoreflect.Message { + mi := &file_ssl_vision_detection_tracked_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) +} + +// Deprecated: Use KickedBall.ProtoReflect.Descriptor instead. +func (*KickedBall) Descriptor() ([]byte, []int) { + return file_ssl_vision_detection_tracked_proto_rawDescGZIP(), []int{1} +} + +func (x *KickedBall) GetPos() *Vector2 { + if x != nil { + return x.Pos + } + return nil +} + +func (x *KickedBall) GetVel() *Vector3 { + if x != nil { + return x.Vel + } + return nil +} + +func (x *KickedBall) GetStartTimestamp() float64 { + if x != nil && x.StartTimestamp != nil { + return *x.StartTimestamp + } + return 0 +} + +func (x *KickedBall) GetStopTimestamp() float64 { + if x != nil && x.StopTimestamp != nil { + return *x.StopTimestamp + } + return 0 +} + +func (x *KickedBall) GetStopPos() *Vector2 { + if x != nil { + return x.StopPos + } + return nil +} + +func (x *KickedBall) GetRobotId() *RobotId { + if x != nil { + return x.RobotId + } + return nil +} + +// A single tracked robot +type TrackedRobot struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RobotId *RobotId `protobuf:"bytes,1,req,name=robot_id,json=robotId" json:"robot_id,omitempty"` + // The position [m] in the ssl-vision coordinate system + Pos *Vector2 `protobuf:"bytes,2,req,name=pos" json:"pos,omitempty"` + // The orientation [rad] in the ssl-vision coordinate system + Orientation *float32 `protobuf:"fixed32,3,req,name=orientation" json:"orientation,omitempty"` + // The velocity [m/s] in the ssl-vision coordinate system + Vel *Vector2 `protobuf:"bytes,4,opt,name=vel" json:"vel,omitempty"` + // The angular velocity [rad/s] in the ssl-vision coordinate system + VelAngular *float32 `protobuf:"fixed32,5,opt,name=vel_angular,json=velAngular" json:"vel_angular,omitempty"` + // The visibility of the robot + // A value between 0 (not visible) and 1 (visible) + // The exact implementation depends on the source software + Visibility *float32 `protobuf:"fixed32,6,opt,name=visibility" json:"visibility,omitempty"` +} + +func (x *TrackedRobot) Reset() { + *x = TrackedRobot{} + if protoimpl.UnsafeEnabled { + mi := &file_ssl_vision_detection_tracked_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TrackedRobot) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackedRobot) ProtoMessage() {} + +func (x *TrackedRobot) ProtoReflect() protoreflect.Message { + mi := &file_ssl_vision_detection_tracked_proto_msgTypes[2] + 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) +} + +// Deprecated: Use TrackedRobot.ProtoReflect.Descriptor instead. +func (*TrackedRobot) Descriptor() ([]byte, []int) { + return file_ssl_vision_detection_tracked_proto_rawDescGZIP(), []int{2} +} + +func (x *TrackedRobot) GetRobotId() *RobotId { + if x != nil { + return x.RobotId + } + return nil +} + +func (x *TrackedRobot) GetPos() *Vector2 { + if x != nil { + return x.Pos + } + return nil +} + +func (x *TrackedRobot) GetOrientation() float32 { + if x != nil && x.Orientation != nil { + return *x.Orientation + } + return 0 +} + +func (x *TrackedRobot) GetVel() *Vector2 { + if x != nil { + return x.Vel + } + return nil +} + +func (x *TrackedRobot) GetVelAngular() float32 { + if x != nil && x.VelAngular != nil { + return *x.VelAngular + } + return 0 +} + +func (x *TrackedRobot) GetVisibility() float32 { + if x != nil && x.Visibility != nil { + return *x.Visibility + } + return 0 +} + +// A frame that contains all currently tracked objects on the field on all cameras +type TrackedFrame struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A monotonous increasing frame counter + FrameNumber *uint32 `protobuf:"varint,1,req,name=frame_number,json=frameNumber" json:"frame_number,omitempty"` + // The unix timestamp in [s] of the data + // If timestamp is larger than timestamp_captured, the source has applied a prediction already + Timestamp *float64 `protobuf:"fixed64,2,req,name=timestamp" json:"timestamp,omitempty"` + // The list of detected balls + // The first ball is the primary one + // Sources may add additional balls based on their capabilities + Balls []*TrackedBall `protobuf:"bytes,3,rep,name=balls" json:"balls,omitempty"` + // The list of detected robots of both teams + Robots []*TrackedRobot `protobuf:"bytes,4,rep,name=robots" json:"robots,omitempty"` + // Information about a kicked ball, if the ball was kicked by a robot and is still moving + // Note: This field is optional. Some source implementations might not set this at any time + KickedBall *KickedBall `protobuf:"bytes,5,opt,name=kicked_ball,json=kickedBall" json:"kicked_ball,omitempty"` + // List of capabilities of the source implementation + Capabilities []Capability `protobuf:"varint,6,rep,name=capabilities,enum=Capability" json:"capabilities,omitempty"` +} + +func (x *TrackedFrame) Reset() { + *x = TrackedFrame{} + if protoimpl.UnsafeEnabled { + mi := &file_ssl_vision_detection_tracked_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TrackedFrame) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackedFrame) ProtoMessage() {} + +func (x *TrackedFrame) ProtoReflect() protoreflect.Message { + mi := &file_ssl_vision_detection_tracked_proto_msgTypes[3] + 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) +} + +// Deprecated: Use TrackedFrame.ProtoReflect.Descriptor instead. +func (*TrackedFrame) Descriptor() ([]byte, []int) { + return file_ssl_vision_detection_tracked_proto_rawDescGZIP(), []int{3} +} + +func (x *TrackedFrame) GetFrameNumber() uint32 { + if x != nil && x.FrameNumber != nil { + return *x.FrameNumber + } + return 0 +} + +func (x *TrackedFrame) GetTimestamp() float64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +func (x *TrackedFrame) GetBalls() []*TrackedBall { + if x != nil { + return x.Balls + } + return nil +} + +func (x *TrackedFrame) GetRobots() []*TrackedRobot { + if x != nil { + return x.Robots + } + return nil +} + +func (x *TrackedFrame) GetKickedBall() *KickedBall { + if x != nil { + return x.KickedBall + } + return nil +} + +func (x *TrackedFrame) GetCapabilities() []Capability { + if x != nil { + return x.Capabilities + } + return nil +} + +var File_ssl_vision_detection_tracked_proto protoreflect.FileDescriptor + +var file_ssl_vision_detection_tracked_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x73, 0x73, 0x6c, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x74, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x73, 0x73, 0x6c, 0x5f, 0x67, 0x63, 0x5f, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x73, 0x73, 0x6c, 0x5f, 0x67, + 0x63, 0x5f, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x65, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x42, 0x61, 0x6c, 0x6c, 0x12, + 0x1a, 0x0a, 0x03, 0x70, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x56, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x33, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x12, 0x1a, 0x0a, 0x03, 0x76, + 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x56, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x33, 0x52, 0x03, 0x76, 0x65, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x76, 0x69, 0x73, + 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x22, 0xde, 0x01, 0x0a, 0x0a, 0x4b, 0x69, 0x63, 0x6b, + 0x65, 0x64, 0x42, 0x61, 0x6c, 0x6c, 0x12, 0x1a, 0x0a, 0x03, 0x70, 0x6f, 0x73, 0x18, 0x01, 0x20, + 0x02, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x32, 0x52, 0x03, 0x70, + 0x6f, 0x73, 0x12, 0x1a, 0x0a, 0x03, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, + 0x08, 0x2e, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x33, 0x52, 0x03, 0x76, 0x65, 0x6c, 0x12, 0x27, + 0x0a, 0x0f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x18, 0x03, 0x20, 0x02, 0x28, 0x01, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x6f, 0x70, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, + 0x0d, 0x73, 0x74, 0x6f, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x23, + 0x0a, 0x08, 0x73, 0x74, 0x6f, 0x70, 0x5f, 0x70, 0x6f, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x08, 0x2e, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x32, 0x52, 0x07, 0x73, 0x74, 0x6f, 0x70, + 0x50, 0x6f, 0x73, 0x12, 0x23, 0x0a, 0x08, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x52, 0x6f, 0x62, 0x6f, 0x74, 0x49, 0x64, 0x52, + 0x07, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x49, 0x64, 0x22, 0xce, 0x01, 0x0a, 0x0c, 0x54, 0x72, 0x61, + 0x63, 0x6b, 0x65, 0x64, 0x52, 0x6f, 0x62, 0x6f, 0x74, 0x12, 0x23, 0x0a, 0x08, 0x72, 0x6f, 0x62, + 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x52, 0x6f, + 0x62, 0x6f, 0x74, 0x49, 0x64, 0x52, 0x07, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x49, 0x64, 0x12, 0x1a, + 0x0a, 0x03, 0x70, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x56, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x32, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x72, + 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x02, 0x28, 0x02, 0x52, + 0x0b, 0x6f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x03, + 0x76, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x56, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x32, 0x52, 0x03, 0x76, 0x65, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x76, 0x65, 0x6c, 0x5f, + 0x61, 0x6e, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x76, + 0x65, 0x6c, 0x41, 0x6e, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x69, 0x73, + 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x76, + 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x22, 0xf9, 0x01, 0x0a, 0x0c, 0x54, 0x72, + 0x61, 0x63, 0x6b, 0x65, 0x64, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x72, + 0x61, 0x6d, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0d, + 0x52, 0x0b, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1c, 0x0a, + 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x02, 0x28, 0x01, + 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x22, 0x0a, 0x05, 0x62, + 0x61, 0x6c, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x54, 0x72, 0x61, + 0x63, 0x6b, 0x65, 0x64, 0x42, 0x61, 0x6c, 0x6c, 0x52, 0x05, 0x62, 0x61, 0x6c, 0x6c, 0x73, 0x12, + 0x25, 0x0a, 0x06, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0d, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x52, 0x6f, 0x62, 0x6f, 0x74, 0x52, 0x06, + 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x0b, 0x6b, 0x69, 0x63, 0x6b, 0x65, 0x64, + 0x5f, 0x62, 0x61, 0x6c, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x4b, 0x69, + 0x63, 0x6b, 0x65, 0x64, 0x42, 0x61, 0x6c, 0x6c, 0x52, 0x0a, 0x6b, 0x69, 0x63, 0x6b, 0x65, 0x64, + 0x42, 0x61, 0x6c, 0x6c, 0x12, 0x2f, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x69, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0b, 0x2e, 0x43, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x69, 0x65, 0x73, 0x2a, 0x92, 0x01, 0x0a, 0x0a, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x41, 0x50, 0x41, 0x42, 0x49, 0x4c, 0x49, + 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, + 0x43, 0x41, 0x50, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x44, 0x45, 0x54, 0x45, 0x43, + 0x54, 0x5f, 0x46, 0x4c, 0x59, 0x49, 0x4e, 0x47, 0x5f, 0x42, 0x41, 0x4c, 0x4c, 0x53, 0x10, 0x01, + 0x12, 0x24, 0x0a, 0x20, 0x43, 0x41, 0x50, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x44, + 0x45, 0x54, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x50, 0x4c, 0x45, 0x5f, 0x42, + 0x41, 0x4c, 0x4c, 0x53, 0x10, 0x02, 0x12, 0x22, 0x0a, 0x1e, 0x43, 0x41, 0x50, 0x41, 0x42, 0x49, + 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x5f, 0x4b, 0x49, 0x43, 0x4b, + 0x45, 0x44, 0x5f, 0x42, 0x41, 0x4c, 0x4c, 0x53, 0x10, 0x03, 0x42, 0x36, 0x5a, 0x34, 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, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2d, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x72, 0x61, 0x63, 0x6b, + 0x65, 0x64, +} + +var ( + file_ssl_vision_detection_tracked_proto_rawDescOnce sync.Once + file_ssl_vision_detection_tracked_proto_rawDescData = file_ssl_vision_detection_tracked_proto_rawDesc +) + +func file_ssl_vision_detection_tracked_proto_rawDescGZIP() []byte { + file_ssl_vision_detection_tracked_proto_rawDescOnce.Do(func() { + file_ssl_vision_detection_tracked_proto_rawDescData = protoimpl.X.CompressGZIP(file_ssl_vision_detection_tracked_proto_rawDescData) + }) + return file_ssl_vision_detection_tracked_proto_rawDescData +} + +var file_ssl_vision_detection_tracked_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_ssl_vision_detection_tracked_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_ssl_vision_detection_tracked_proto_goTypes = []interface{}{ + (Capability)(0), // 0: Capability + (*TrackedBall)(nil), // 1: TrackedBall + (*KickedBall)(nil), // 2: KickedBall + (*TrackedRobot)(nil), // 3: TrackedRobot + (*TrackedFrame)(nil), // 4: TrackedFrame + (*Vector3)(nil), // 5: Vector3 + (*Vector2)(nil), // 6: Vector2 + (*RobotId)(nil), // 7: RobotId +} +var file_ssl_vision_detection_tracked_proto_depIdxs = []int32{ + 5, // 0: TrackedBall.pos:type_name -> Vector3 + 5, // 1: TrackedBall.vel:type_name -> Vector3 + 6, // 2: KickedBall.pos:type_name -> Vector2 + 5, // 3: KickedBall.vel:type_name -> Vector3 + 6, // 4: KickedBall.stop_pos:type_name -> Vector2 + 7, // 5: KickedBall.robot_id:type_name -> RobotId + 7, // 6: TrackedRobot.robot_id:type_name -> RobotId + 6, // 7: TrackedRobot.pos:type_name -> Vector2 + 6, // 8: TrackedRobot.vel:type_name -> Vector2 + 1, // 9: TrackedFrame.balls:type_name -> TrackedBall + 3, // 10: TrackedFrame.robots:type_name -> TrackedRobot + 2, // 11: TrackedFrame.kicked_ball:type_name -> KickedBall + 0, // 12: TrackedFrame.capabilities:type_name -> Capability + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name +} + +func init() { file_ssl_vision_detection_tracked_proto_init() } +func file_ssl_vision_detection_tracked_proto_init() { + if File_ssl_vision_detection_tracked_proto != nil { + return + } + file_ssl_gc_common_proto_init() + file_ssl_gc_geometry_proto_init() + if !protoimpl.UnsafeEnabled { + file_ssl_vision_detection_tracked_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TrackedBall); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ssl_vision_detection_tracked_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KickedBall); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ssl_vision_detection_tracked_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TrackedRobot); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ssl_vision_detection_tracked_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TrackedFrame); 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_vision_detection_tracked_proto_rawDesc, + NumEnums: 1, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ssl_vision_detection_tracked_proto_goTypes, + DependencyIndexes: file_ssl_vision_detection_tracked_proto_depIdxs, + EnumInfos: file_ssl_vision_detection_tracked_proto_enumTypes, + MessageInfos: file_ssl_vision_detection_tracked_proto_msgTypes, + }.Build() + File_ssl_vision_detection_tracked_proto = out.File + file_ssl_vision_detection_tracked_proto_rawDesc = nil + file_ssl_vision_detection_tracked_proto_goTypes = nil + file_ssl_vision_detection_tracked_proto_depIdxs = nil +} diff --git a/pkg/tracked/ssl_vision_wrapper_tracked.pb.go b/pkg/tracked/ssl_vision_wrapper_tracked.pb.go new file mode 100644 index 0000000..833b95d --- /dev/null +++ b/pkg/tracked/ssl_vision_wrapper_tracked.pb.go @@ -0,0 +1,177 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.15.7 +// source: ssl_vision_wrapper_tracked.proto + +package tracked + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// A wrapper packet containing meta data of the source +// Also serves for the possibility to extend the protocol later +type TrackerWrapperPacket struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A random UUID of the source that is kept constant at the source while running + // If multiple sources are broadcasting to the same network, this id can be used to identify individual sources + Uuid *string `protobuf:"bytes,1,req,name=uuid" json:"uuid,omitempty"` + // The name of the source software that is producing this messages. + SourceName *string `protobuf:"bytes,2,opt,name=source_name,json=sourceName" json:"source_name,omitempty"` + // The tracked frame + TrackedFrame *TrackedFrame `protobuf:"bytes,3,opt,name=tracked_frame,json=trackedFrame" json:"tracked_frame,omitempty"` +} + +func (x *TrackerWrapperPacket) Reset() { + *x = TrackerWrapperPacket{} + if protoimpl.UnsafeEnabled { + mi := &file_ssl_vision_wrapper_tracked_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TrackerWrapperPacket) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackerWrapperPacket) ProtoMessage() {} + +func (x *TrackerWrapperPacket) ProtoReflect() protoreflect.Message { + mi := &file_ssl_vision_wrapper_tracked_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) +} + +// Deprecated: Use TrackerWrapperPacket.ProtoReflect.Descriptor instead. +func (*TrackerWrapperPacket) Descriptor() ([]byte, []int) { + return file_ssl_vision_wrapper_tracked_proto_rawDescGZIP(), []int{0} +} + +func (x *TrackerWrapperPacket) GetUuid() string { + if x != nil && x.Uuid != nil { + return *x.Uuid + } + return "" +} + +func (x *TrackerWrapperPacket) GetSourceName() string { + if x != nil && x.SourceName != nil { + return *x.SourceName + } + return "" +} + +func (x *TrackerWrapperPacket) GetTrackedFrame() *TrackedFrame { + if x != nil { + return x.TrackedFrame + } + return nil +} + +var File_ssl_vision_wrapper_tracked_proto protoreflect.FileDescriptor + +var file_ssl_vision_wrapper_tracked_proto_rawDesc = []byte{ + 0x0a, 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, 0x22, 0x73, 0x73, 0x6c, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x64, + 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7f, 0x0a, 0x14, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, + 0x72, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, + 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x32, 0x0a, 0x0d, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x5f, 0x66, + 0x72, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x54, 0x72, 0x61, + 0x63, 0x6b, 0x65, 0x64, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x0c, 0x74, 0x72, 0x61, 0x63, 0x6b, + 0x65, 0x64, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x42, 0x36, 0x5a, 0x34, 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, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2d, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, +} + +var ( + file_ssl_vision_wrapper_tracked_proto_rawDescOnce sync.Once + file_ssl_vision_wrapper_tracked_proto_rawDescData = file_ssl_vision_wrapper_tracked_proto_rawDesc +) + +func file_ssl_vision_wrapper_tracked_proto_rawDescGZIP() []byte { + file_ssl_vision_wrapper_tracked_proto_rawDescOnce.Do(func() { + file_ssl_vision_wrapper_tracked_proto_rawDescData = protoimpl.X.CompressGZIP(file_ssl_vision_wrapper_tracked_proto_rawDescData) + }) + return file_ssl_vision_wrapper_tracked_proto_rawDescData +} + +var file_ssl_vision_wrapper_tracked_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_ssl_vision_wrapper_tracked_proto_goTypes = []interface{}{ + (*TrackerWrapperPacket)(nil), // 0: TrackerWrapperPacket + (*TrackedFrame)(nil), // 1: TrackedFrame +} +var file_ssl_vision_wrapper_tracked_proto_depIdxs = []int32{ + 1, // 0: TrackerWrapperPacket.tracked_frame:type_name -> TrackedFrame + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_ssl_vision_wrapper_tracked_proto_init() } +func file_ssl_vision_wrapper_tracked_proto_init() { + if File_ssl_vision_wrapper_tracked_proto != nil { + return + } + file_ssl_vision_detection_tracked_proto_init() + if !protoimpl.UnsafeEnabled { + file_ssl_vision_wrapper_tracked_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TrackerWrapperPacket); 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_vision_wrapper_tracked_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ssl_vision_wrapper_tracked_proto_goTypes, + DependencyIndexes: file_ssl_vision_wrapper_tracked_proto_depIdxs, + MessageInfos: file_ssl_vision_wrapper_tracked_proto_msgTypes, + }.Build() + File_ssl_vision_wrapper_tracked_proto = out.File + file_ssl_vision_wrapper_tracked_proto_rawDesc = nil + file_ssl_vision_wrapper_tracked_proto_goTypes = nil + file_ssl_vision_wrapper_tracked_proto_depIdxs = nil +} diff --git a/pkg/vision/ssl_vision_detection.pb.go b/pkg/vision/ssl_vision_detection.pb.go index 3c513b9..221bd79 100644 --- a/pkg/vision/ssl_vision_detection.pb.go +++ b/pkg/vision/ssl_vision_detection.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.12.4 +// protoc-gen-go v1.26.0 +// protoc v3.15.7 // source: ssl_vision_detection.proto package vision import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type SSL_DetectionBall struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/pkg/vision/ssl_vision_geometry.pb.go b/pkg/vision/ssl_vision_geometry.pb.go index bb38c38..8f55816 100644 --- a/pkg/vision/ssl_vision_geometry.pb.go +++ b/pkg/vision/ssl_vision_geometry.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.12.4 +// protoc-gen-go v1.26.0 +// protoc v3.15.7 // source: ssl_vision_geometry.proto package vision import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type SSL_FieldShapeType int32 const ( diff --git a/pkg/vision/ssl_vision_wrapper.pb.go b/pkg/vision/ssl_vision_wrapper.pb.go index 0a45e8f..60bdf13 100644 --- a/pkg/vision/ssl_vision_wrapper.pb.go +++ b/pkg/vision/ssl_vision_wrapper.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.12.4 +// protoc-gen-go v1.26.0 +// protoc v3.15.7 // source: ssl_vision_wrapper.proto package vision import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type SSL_WrapperPacket struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/pkg/visualization/ssl_visualization.pb.go b/pkg/visualization/ssl_visualization.pb.go index e9ab48d..db263d9 100644 --- a/pkg/visualization/ssl_visualization.pb.go +++ b/pkg/visualization/ssl_visualization.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.12.4 +// protoc-gen-go v1.26.0 +// protoc v3.15.7 // source: ssl_visualization.proto package visualization import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - // Color encoded in RGB type RgbColor struct { state protoimpl.MessageState diff --git a/proto/tracked/ssl_gc_common.proto b/proto/tracked/ssl_gc_common.proto new file mode 100644 index 0000000..ac94e86 --- /dev/null +++ b/proto/tracked/ssl_gc_common.proto @@ -0,0 +1,27 @@ +syntax = "proto2"; +option go_package = "github.com/RoboCup-SSL/ssl-vision-client/pkg/tracked"; + +// 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; +} diff --git a/proto/tracked/ssl_gc_geometry.proto b/proto/tracked/ssl_gc_geometry.proto new file mode 100644 index 0000000..dc71191 --- /dev/null +++ b/proto/tracked/ssl_gc_geometry.proto @@ -0,0 +1,15 @@ +syntax = "proto2"; +option go_package = "github.com/RoboCup-SSL/ssl-vision-client/pkg/tracked"; + +// 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; +} diff --git a/proto/tracked/ssl_vision_detection_tracked.proto b/proto/tracked/ssl_vision_detection_tracked.proto new file mode 100644 index 0000000..8fae42b --- /dev/null +++ b/proto/tracked/ssl_vision_detection_tracked.proto @@ -0,0 +1,90 @@ +syntax = "proto2"; +option go_package = "github.com/RoboCup-SSL/ssl-vision-client/pkg/tracked"; + +import "ssl_gc_common.proto"; +import "ssl_gc_geometry.proto"; + +// Default network address: 224.5.23.2:10010 + +// Capabilities that a source implementation can have +enum Capability { + CAPABILITY_UNKNOWN = 0; + CAPABILITY_DETECT_FLYING_BALLS = 1; + CAPABILITY_DETECT_MULTIPLE_BALLS = 2; + CAPABILITY_DETECT_KICKED_BALLS = 3; +} + +// A single tracked ball +message TrackedBall { + // The position (x, y, height) [m] in the ssl-vision coordinate system + required Vector3 pos = 1; + + // The velocity [m/s] in the ssl-vision coordinate system + optional Vector3 vel = 2; + + // The visibility of the ball + // A value between 0 (not visible) and 1 (visible) + // The exact implementation depends on the source software + optional float visibility = 3; +} + +// A ball kicked by a robot, including predictions when the ball will come to a stop +message KickedBall { + // The initial position [m] from which the ball was kicked + required Vector2 pos = 1; + // The initial velocity [m/s] with which the ball was kicked + required Vector3 vel = 2; + // The unix timestamp [s] when the kick was performed + required double start_timestamp = 3; + + // The predicted unix timestamp [s] when the ball comes to a stop + optional double stop_timestamp = 4; + // The predicted position [m] at which the ball will come to a stop + optional Vector2 stop_pos = 5; + + // The robot that kicked the ball + optional RobotId robot_id = 6; +} + +// A single tracked robot +message TrackedRobot { + required RobotId robot_id = 1; + + // The position [m] in the ssl-vision coordinate system + required Vector2 pos = 2; + // The orientation [rad] in the ssl-vision coordinate system + required float orientation = 3; + + // The velocity [m/s] in the ssl-vision coordinate system + optional Vector2 vel = 4; + // The angular velocity [rad/s] in the ssl-vision coordinate system + optional float vel_angular = 5; + + // The visibility of the robot + // A value between 0 (not visible) and 1 (visible) + // The exact implementation depends on the source software + optional float visibility = 6; +} + +// A frame that contains all currently tracked objects on the field on all cameras +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 + // The first ball is the primary one + // Sources may add additional balls based on their capabilities + repeated TrackedBall balls = 3; + // The list of detected robots of both teams + repeated TrackedRobot robots = 4; + + // Information about a kicked ball, if the ball was kicked by a robot and is still moving + // Note: This field is optional. Some source implementations might not set this at any time + optional KickedBall kicked_ball = 5; + + // List of capabilities of the source implementation + repeated Capability capabilities = 6; +} diff --git a/proto/tracked/ssl_vision_wrapper_tracked.proto b/proto/tracked/ssl_vision_wrapper_tracked.proto new file mode 100644 index 0000000..ec288ae --- /dev/null +++ b/proto/tracked/ssl_vision_wrapper_tracked.proto @@ -0,0 +1,16 @@ +syntax = "proto2"; +option go_package = "github.com/RoboCup-SSL/ssl-vision-client/pkg/tracked"; + +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 +message TrackerWrapperPacket { + // A random UUID of the source that is kept constant at the source while running + // If multiple sources are broadcasting to the same network, this id can be used to identify individual sources + required string uuid = 1; + // The name of the source software that is producing this messages. + optional string source_name = 2; + // The tracked frame + optional TrackedFrame tracked_frame = 3; +} diff --git a/src/App.vue b/src/App.vue index c7647a2..3cd7289 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,15 +1,18 @@ + + diff --git a/src/main.js b/src/main.js index 5a64488..ce70434 100644 --- a/src/main.js +++ b/src/main.js @@ -5,6 +5,9 @@ import VueNativeSock from 'vue-native-websocket' Vue.config.productionTip = false; +const urlParams = new URLSearchParams(window.location.search); +const sourceId = urlParams.get('sourceId'); + let wsAddress; if (process.env.NODE_ENV === 'development') { // use the default backend port @@ -20,6 +23,10 @@ if (process.env.NODE_ENV === 'development') { wsAddress = protocol + '//' + window.location.hostname + ':' + window.location.port + '/api/vision'; } +if (sourceId) { + wsAddress += `?sourceId=${sourceId}` +} + Vue.use(VueNativeSock, wsAddress, { reconnection: true, format: 'json', diff --git a/src/store.js b/src/store.js index fcce90b..35a04e9 100644 --- a/src/store.js +++ b/src/store.js @@ -8,6 +8,8 @@ let fieldLength = 12000; let centerCircleRadius = 500; let defaultField = { + activeSourceId: '', + sources: {}, fieldWidth: fieldWidth, fieldLength: fieldLength, boundaryWidth: 300,