ZebraDevs / rosgo

Pure Go implementation of ROS client library
Other
61 stars 19 forks source link

Bug with multimaster_fkie #35

Open Filea opened 4 years ago

Filea commented 4 years ago

Good morning.

Everytime that I try to subscribe a ROS topic using ROSGO and with a multimaster_fkie connection between two robots, the subscriber crashes and the following error is displayed:


Received: asd
2020/05/11 11:42:16 [DEBUG] 7
2020/05/11 11:42:16 [DEBUG] Receive msgChan
2020/05/11 11:42:16 [DEBUG] Callback job enqueued.
2020/05/11 11:42:16 [DEBUG] Loop
2020/05/11 11:42:16 [DEBUG] Execute job
Received: asd
2020/05/11 11:42:16 [DEBUG] Slave API publisherUpdate() called.
2020/05/11 11:42:16 [DEBUG] Receive pubListChan
2020/05/11 11:42:16 [DEBUG] Slave API publisherUpdate() called.
2020/05/11 11:42:16 [FATAL] [DefaultSubscriber] ROS Master API call failed with code -1: Not a publisher of [/chatter]

Best, Filipe

cjds commented 4 years ago

I've not actually tried multimaster yet. I will try it and get back to you. In the meantime can you give me a minimal go example that I could run?

Filea commented 4 years ago

Good afternoon,

Thank you for your response. Sure, you just need to have two machines within the same network, multimaster_fkie installed on both machines and ROSGO.

Machine 1:

Machine 2:

The program will die after a while with the following error:


Received: Hey
2020/05/19 17:21:29 [DEBUG] Slave API publisherUpdate() called.
2020/05/19 17:21:29 [DEBUG] Receive pubListChan
2020/05/19 17:21:29 [DEBUG] Slave API publisherUpdate() called.
2020/05/19 17:21:29 [FATAL] [DefaultSubscriber] ROS Master API call failed with code -1: Not a publisher of [/test]

ROSGO subscriber that I'm using:

package main

//go:generate gengo msg std_msgs/String
import (
    "fmt"
    "os"
    "std_msgs"

    "github.com/fetchrobotics/rosgo/ros"
)

func callback(msg *std_msgs.String) {
    fmt.Printf("Received: %s\n", msg.Data)
}

func main() {
    node, err := ros.NewNode("/listener", os.Args)
    if err != nil {
        fmt.Println(err)
        os.Exit(-1)
    }
    defer node.Shutdown()
    node.Logger().SetSeverity(ros.LogLevelDebug)
    node.NewSubscriber("/test", std_msgs.MsgString, callback)
    node.Spin()
}
cjds commented 4 years ago

Interesting. I'll take a look

Filea commented 4 years ago

Thank you. Let me know if you need anything else.

cjds commented 4 years ago

I'm trying to look into this but I'm having trouble replicating.

  1. What version of ROS are you using?
  2. master_discovery.launch can you hand me the code in this file? I can't find the reference to it in this repo https://github.com/fkie/multimaster_fkie
  3. Does this work with pure rostopic echo rostopic pub on both machines? Does this work with Python on both ends?