Skip to content

Commit 91bd718

Browse files
committed
rudimentary subscription working
1 parent 26ee6b2 commit 91bd718

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

example/main.go

+18
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
package main
22

33
import (
4+
"encoding/json"
45
"log"
56

67
"github.com/brychanrobot/goros"
78
)
89

10+
type Uav struct {
11+
Tracks []Track `json:"tracks"`
12+
}
13+
14+
type Track struct {
15+
MeanX float64 `json:"meanx"`
16+
MeanY float64 `json:"meany"`
17+
Label int `json:"label"`
18+
InlierRatio float64 `json:"inliers"`
19+
}
20+
921
func main() {
1022
ros := goros.NewRos("ws://192.168.27.20:9090")
1123

1224
topics := ros.GetTopics()
1325
log.Println(topics)
1426

27+
ros.Subscribe("/visual_mtt/rransac_tracks", func(msg *json.RawMessage) {
28+
var uav Uav
29+
json.Unmarshal(*msg, &uav)
30+
log.Println(uav)
31+
})
32+
1533
select {} //keeps the application open
1634
}

0 commit comments

Comments
 (0)