You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am at the right place and my issue is directly related to ROS#. General technical questions I would post e.g. at ROS Answers or Stack Overflow. For library-specific questions I would look for help in the corresponding library forums.
I have thoroughly read the Contributing Guideline and writing this issue is the right thing to do in my case.
I have a question!
I searched the Wiki, open and closed issues for an answer. I tried my best to find the answer by myself without success. I believe that the discussion we will have in this issue, and the solutions we might find, will help me, and likely other community members who have a similar problem.
Here is my question:
My OS is: Ubuntu 18.04
My Unity Version is: 2019.4.15
My ROS Distribution is: ROS2 (Eloquent)
My Build Target Platform is: Windows 10
I am able to subscribe to topics and receive data in Unity using ros2-web-bridge and the ROS# library provided (e.g. String, Twist). I am now attempting to subscribe to custom messages, however am not receiving the topic's data in Unity. Any help would be appreciated!
My topic ("/topic") is publishing a custom message (Num.msg) with the following data:
float64 hr
float64 timestamp
When running the node, I can see that the topic is publishing data as expected. I can see this in rqt and when running "ros2 topic echo /topic" I get the below sample output:
I have followed the tutorial on How to add new message types. I have attempted Option 1 and 3 with no success. When running in Unity, I can see that Start() is called, but ReceiveMessage() is not. My message and subscriber scripts are below. I have also included a screenshot of the application running on Unity, showing TwistSubscriber working, but not MyNumSubscriber.
RosSharpMessages - Num.cs
namespace RosSharp.RosBridgeClient.MessageTypes.PyPubsub
{
public class Num : Message
{
public const string RosMessageName = "tutorial_interfaces/Num";
// int64 num
public double hr { get; set; }
public double timestamp { get; set; }
public Num()
{
this.hr = 0.0;
this.timestamp = 0.0;
}
public Num(double hr, double timestamp)
{
this.hr = hr;
this.timestamp = timestamp;
}
}
}
RosCommunication - MyNumSubscriber.cs
using UnityEngine;
using System;
namespace RosSharp.RosBridgeClient
{
public class MyNumSubscriber : UnitySubscriber<MessageTypes.PyPubsub.Num>
{
public double myHr;
public double myTimestamp;
protected override void Start()
{
print("start Num");
base.Start();
}
protected override void ReceiveMessage(MessageTypes.PyPubsub.Num message)
{
// Process message data
print("NEW MESSAGE Rx");
myHr = message.hr;
myTimestamp = message.timestamp;
}
}
}
I found a bug!
I am using the latest ROS# version available here on the master branch.
I am adding all required information, code and data files, screenshots and log files so that you can reproduce the problem.
The text was updated successfully, but these errors were encountered:
I was able to reproduce the issue, and found the solution in the ros2-web-bridge issue board. Please see here, and here.
It seems that at the first time you run the rosbridge, some .js scripts are generated in accordance with the message definitions in your ros2 environment. If you introduce some more message definitions to your ros2 environment after running the rosbridge, generation of new .js scripts for the new message definitions are not triggered.
Simply delete the folder $your-ros2-web-bridge-path/node_modules/rclnodejs/generated/, then run the rosbridge again. You should see your custom-message-related .js files under that folder.
Eventually I was able to send/receive the custom messages within Unity via ROS# and ros2-web-bridge.
I think this issue is related to ros2-web-bridge framework.
PS: You can always import the source code of the RosBridgeClient into your Assets instead of importing the .dll file, so that you can fully debug the code. I first checked the deserialized data received from rosbridge, which includes error logs if any.
I have a question!
Here is my question:
My OS is: Ubuntu 18.04
My Unity Version is: 2019.4.15
My ROS Distribution is: ROS2 (Eloquent)
My Build Target Platform is: Windows 10
I am able to subscribe to topics and receive data in Unity using ros2-web-bridge and the ROS# library provided (e.g. String, Twist). I am now attempting to subscribe to custom messages, however am not receiving the topic's data in Unity. Any help would be appreciated!
My topic ("/topic") is publishing a custom message (Num.msg) with the following data:
When running the node, I can see that the topic is publishing data as expected. I can see this in rqt and when running "ros2 topic echo /topic" I get the below sample output:
I have followed the tutorial on How to add new message types. I have attempted Option 1 and 3 with no success. When running in Unity, I can see that Start() is called, but ReceiveMessage() is not. My message and subscriber scripts are below. I have also included a screenshot of the application running on Unity, showing TwistSubscriber working, but not MyNumSubscriber.
RosSharpMessages - Num.cs
RosCommunication - MyNumSubscriber.cs
I found a bug!
The text was updated successfully, but these errors were encountered: