siemens / ros-sharp

ROS# is a set of open source software libraries and tools in C# for communicating with ROS from .NET applications, in particular Unity3D
Apache License 2.0
984 stars 373 forks source link

Realtime subscribing problem on Ubuntu #437

Closed ftatp closed 10 months ago

ftatp commented 2 years ago

I found a bug!

I am using Ros noetic on Ubuntu 20.04 and trying to stream a Lidar senor's data using a provided publisher topic node from https://github.com/HesaiTechnology/HesaiLidar_General_ROS

Here is my bug description: The publisher publishes the data perfectly, but it seems to subscribe for a few seconds, then stops for a few seconds, run again, and this repeats for the whole execute lifetime. It runs perfectly in the UnityEditor, but I found this bug when I build and run the exe on Ubuntu.

The code is the same as the PointCloud generator provided in the other issues, but the problem is on the subscribing. `public void CreateConnection() { _isConnected = true; _ros = ROSConnection.GetOrCreateInstance(); _ros.Subscribe("/hesai/pandar", Callback); }

void Callback(PointCloud2 message) { _messageReceived = true; _message = message; _messageId++; }

void Update() { if(_messageReceived) { GeneratePointCloud(); // <<-- This sets _messageReceived = false DataVisualizer.PointCloudRenderer.Instance.RenderPoints(); } }`

It doesn't enter the Update if condition for a while. Can you check what the problem is??

MartinBischoff commented 10 months ago

outdated / closing due to inactivity