rosbridge_suite icon indicating copy to clipboard operation
rosbridge_suite copied to clipboard

Cant Subscribe to custom message from Unity with ROS#

Open KianRK opened this issue 1 year ago • 1 comments

Description

  • Library Version: 1.3.1
  • ROS Version: humble
  • Platform / OS: Windows 10 / Ubuntu 22.04

Hi,

I am trying to subscribe to the /audio/audio topic of the audio_common package from inside Unity.

Unity (2020.3.40) is running on Windows 10 and inside a vm I have Ubuntu 22.04 running.

The WebSocket server is running fine and I can even Subscriber to topics and receive them on Unity side.

But when I try to implement the message for /audio/audio on Unity side and then try to subscribe to the topic, I get:

Error [id: /audio/audio:0] subscribe: is not a valid type string.

I can subscribe to the same topic from a built-in subscriber script, so I guess the error is somewhere in the Serialization of my custom Message type.

I tried every possible way of adding the message according to the ros# wiki https://github.com/siemens/ros-sharp/wiki/Dev_NewMessageTypes

Steps To Reproduce This is how my custom message looks like in C#

`namespace RosSharp.RosBridgeClient.MessageTypes.AudioCommon { public class AudioData : Message { public const string RosMessageName = "audio_common_msgs/msg/AudioData";

    public byte[] data { get; set; }

    public AudioData()
    {
        this.data = new byte[0];
    }

    public AudioData(byte[] data)
    {
        this.data = data;
    }
}

}`

KianRK avatar Aug 13 '23 20:08 KianRK

This issue has been marked as stale because there has been no activity in the past 12 months. Please add a comment to keep it open.

github-actions[bot] avatar Aug 13 '24 00:08 github-actions[bot]