ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

hermonir's profile - activity

2019-05-20 02:01:52 -0500 marked best answer Unity Mavros client disconnects automatically

I'm using ROSBridgeLib in Unity3D 2017.1 to connect to ROS on Ubuntu.

The turtlesim project works fine. I can control the turtle from Unity. I wrote a test subscriber to see talker messages ("/chatter") and it works fine as well.

When I tried connecting to mavros topics, for example "/mavros/global_position/compass_hdg", ROSBridge immediately disconnects the client. It says:

[INFO] [1505825883.664602]: [Client 21] Subscribed to /mavros/global_position/compass_hdg [INFO] [1505825883.910471]: Client disconnected. 0 clients total.

Here is my subscriber code:

using ROSBridgeLib;
using ROSBridgeLib.std_msgs;
using ROSBridgeLib.turtlesim;
using System.Collections;
using SimpleJSON;
using UnityEngine;

public class MavrosGlobalpositionCompassHdg : ROSBridgeSubscriber {

    public new static string GetMessageTopic() {
        return "/mavros/global_position/compass_hdg";
    }  

    public new static string GetMessageType() {
        return "std_msgs/Float64";
    }

    public new static ROSBridgeMsg ParseMessage(JSONNode msg) {
        return new Float64Msg(msg);
    }

    public new static void CallBack(ROSBridgeMsg msg) {
        Float64Msg hdg = (Float64Msg) msg;
        Debug.Log("MAVROS message: " + hdg.ToString());
    }
}

Thanks for any help.

2019-05-20 02:00:33 -0500 received badge  Famous Question (source)
2019-05-20 02:00:33 -0500 received badge  Notable Question (source)
2018-07-10 10:55:52 -0500 received badge  Famous Question (source)
2017-11-20 05:57:36 -0500 received badge  Notable Question (source)
2017-10-25 06:47:04 -0500 received badge  Popular Question (source)
2017-10-23 09:38:20 -0500 asked a question Publish image from Unity

Publish image from Unity I'm trying to send an image (Texture2D) to RosBridge running on Ubuntu. Simple data types work

2017-10-09 03:40:08 -0500 received badge  Teacher (source)
2017-10-09 03:40:08 -0500 received badge  Self-Learner (source)
2017-10-09 03:39:30 -0500 received badge  Popular Question (source)
2017-10-09 02:41:16 -0500 answered a question Unity Mavros client disconnects automatically

Fixed it. The problem was in Float64Msg.cs in ROSBridgeLib. Inside Float64Msg(JSONNode msg), it tried parsing a json s

2017-10-09 02:36:23 -0500 received badge  Enthusiast
2017-10-05 15:56:11 -0500 asked a question Unity Mavros client disconnects automatically

Unity Mavros client disconnects automatically I'm using ROSBridgeLib in Unity3D 2017.1 to connect to ROS on Ubuntu. The