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
974 stars 370 forks source link

LaserScanSubscriber doesn´t work #392

Closed mrmanu closed 3 years ago

mrmanu commented 3 years ago

Hello,my problem is that laserScanSubscriber doesn't work, it just doesn't get the message and it doesn't go into the ReceiveMessage function. This does not happen with any other type of message and subscription that I have tried. I have checked the topic (/scan from turtlebot2) and it is correct. I have debugged the code and the scripts from library as much as possible and I can't find the problem, the LaserScan type seems to be fine, this subscriber just doesn't work. Anyone else has happened? Do you know why it happens? Thanks.

I don't know if this is a bug or it happens only to me but it is very strange

Perform the following steps reproduce the bug:

  1. Install gazebo and turtlebot2 packages and run turtlebot2 example
  2. Subscribe to /scan using laserScanSubscriber

Observed results: LaserScanSubscriber doesn´t receive the message

Relevant Code:

namespace RosSharp.RosBridgeClient
{
    public class LaserScanSubscriber : UnitySubscriber<MessageTypes.Sensor.LaserScan>
    {
        public LaserScanWriter laserScanWriter;

        protected override void Start()
        {
            base.Start();
        }

        protected override void ReceiveMessage(MessageTypes.Sensor.LaserScan laserScan)
        {
            print("AAAA");
            laserScanWriter.Write(laserScan);
        }
    }
} 

MartinBischoff commented 3 years ago

Hi @mrmanu , your issue seems to duplicate https://github.com/siemens/ros-sharp/issues/346. I found two suggestions there:

mrmanu commented 3 years ago

Hello @MartinBischoff , thanks for the reply. I think my problem is different from those, however I have tried these solutions and they do not work for me. I have checked the RosBridge protocol and it should be correct since all other topics are subscribed correctly. I have also replaced System.Threading.Tasks.Extensions.dll with the latest updated one and it gives no results. I think the problem must be in LaserScan in particular since all the other topics work correctly, and I have even created new types (to subscribe to the pcl/PolygonMesh topic) and they work fine.

berkayalpcakal commented 3 years ago

Hello @mrmanu,

Have you checked the issues #78, #334, #377? This could be a known issue regarding the serialization of NaN/inf values within the laserscan message.

If you think that the issue is not related to aforementioned issues, maybe you can try out the RosBridgeConsoleExample by adjusting it in a way that you would only have a laserscan subscriber. You can just open the Visual Studio solution under the Libraries folder and run the console example. This would help you debug every step of the handling of incoming messages, e.g. you can check what happens when this line is being executed.

I think it is not possible to reproduce your issue with the current info you provided. I really suggest you to debug the library thoroughly to find out an error.