|
@@ -16,7 +16,7 @@ func main() {
|
|
|
rosPublisher, err := goroslib.NewPublisher(goroslib.PublisherConf{
|
|
|
Node: RosNode,
|
|
|
Topic: "/competition",
|
|
|
- Msg: std_msgs.String{},
|
|
|
+ Msg: &std_msgs.String{}, // msg必须是指针
|
|
|
})
|
|
|
if err != nil {
|
|
|
slog.Error("程序崩溃,创建ros发布者competition失败:", err)
|
|
@@ -27,7 +27,7 @@ func main() {
|
|
|
for {
|
|
|
time.Sleep(time.Duration(1) * time.Second)
|
|
|
// 下发数据
|
|
|
- rosPublisher.Write(std_msgs.String{
|
|
|
+ rosPublisher.Write(&std_msgs.String{
|
|
|
Data: "cicv测试队名",
|
|
|
})
|
|
|
slog.Info("发送数据 cicv测试队名 成功")
|