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
961 stars 365 forks source link

Turtlebot 2 Laserscan issues #377

Closed bryceikeda closed 3 years ago

bryceikeda commented 3 years ago

I have a question!

Here is my question:

I am trying to receive laser scan data from the /scan topic published by my Turtlebot 2. For some reason Unity is not receiving the scans. Interestingly though, a GUI I wrote in ROS displays both my simulated laser scan and the laser scan published by the Turtlebot 2. This is how I know the Turtlebot 2 is publishing data to the correct topic. Unity on the other hand, only displays the laser scan published by my simulation. I put a Debug.Log statement in my Laser Scan Subscriber and it does not get triggered by the Turtlebot 2 /scan data.

I followed the steps on issue #372 which had an almost similar problem with the laser scan subscriber but it did not fix my problem. I have attached bag files with the broken published /scan data and the working published /scan data. I am using the Laser Scan Subscriber, Laser Scan Visualizer Lines and Laser Scan Writer scripts in my project. Does anyone have any insight as to what the problem is?

bagfiles.zip

bryceikeda commented 3 years ago

I figured out the problem. The /scan messages coming from the Turtlebot had a bunch of 'nan' ranges. I created a new topic that published a laserscan message that switched all the 'nan' ranges to 0.0. Now the Laser Scan Subscriber receives the message properly and displays them in Unity.

MartinBischoff commented 3 years ago

This issue has been discussed in this board multiple times already, e.g. https://github.com/siemens/ros-sharp/issues/78 and https://github.com/siemens/ros-sharp/issues/334

ZahraaBass commented 3 years ago

Hello @bryceikeda, would you mind sharing the script you wrote for switching the "nan" ranges?

bryceikeda commented 3 years ago

@ZahraaBass I just for loop through all of the ranges in /scan and use isnan() to figure out if it is nan. If it is, I replace it with 0.0. Once that is done I publish the fixed scan variable over a new topic such as /fixed_scan