ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

ROS & MatlabSimulink vs LIDAR

asked 2018-12-22 14:21:27 -0600

Piotr gravatar image

updated 2018-12-24 02:58:10 -0600

jayess gravatar image


I am getting acquainted with the operation of the ROS environment and I was very interested in the project called turtlebot3. It allows me to simulate a robot with a lidar sensor and visualizations of this process in RVIZ. I would now like to download information about the lidar readings in order to develop a robot positioning algorithm between the table legs in the matlab.

Unfortunately, despite the fact that the message / scan contains 360 items, Matlab allows reading only 128 items, which limits the reading angle of lidar to 128 degrees.

How can you fix it? I attach the screenshots in links:

Greetings, Piotr

image description

image description

Terminal output


We have 360 ​​readings in the rostopic echo. You can see four places where the readings are different from zero / inf. The readings match because the robot is between the table legs. Unfortunately, Matlab limits the angle to 128 readings, which means that only one leg of the table is visible.

Besides the simple model in simulink, I do not use any matlab functions (only rosinite).

edit retag flag offensive close merge delete



Could you please attach your images directly to the post? I've given you sufficient karma for that.

gvdhoorn gravatar image gvdhoorn  ( 2018-12-22 14:58:46 -0600 )edit

Done. Thank you.

Piotr gravatar image Piotr  ( 2018-12-22 15:39:33 -0600 )edit

@Piotr I've edited your question so that the images show up directly without having to follow a link, except for the screen shot of the text. Can you please update your question with a copy & paste of the text instead of an image?

jayess gravatar image jayess  ( 2018-12-22 21:05:03 -0600 )edit

Now is ok? ;)

Piotr gravatar image Piotr  ( 2018-12-23 01:27:02 -0600 )edit

I've just had a look at the rostopic echo output, and that scan contains just under 200 samples not 360. Can you show us the matlab code you're using because we won't be able to help you otherwise.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-12-23 19:21:44 -0600 )edit

The post has been updated

Piotr gravatar image Piotr  ( 2018-12-24 03:21:30 -0600 )edit

Hello, Did you find a solution for this? I am facing the same issue

Firas gravatar image Firas  ( 2019-11-20 08:55:01 -0600 )edit


the answer is: Tools -> Robot Operating System -> Manage Array Sizes

you need to change the value from 128 to 360

Piotr gravatar image Piotr  ( 2019-11-24 15:17:35 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-11-20 09:13:29 -0600

Firas gravatar image

In case someone is still facing this issue, Matlab explains how to change the limits imposed on variable string messages under the following link (Work with ROS Messages in Simulink®):

The issue which remains is that sometimes you don't have the ROS Toolbox part under the simulation tab. If this is the case, go to APPS and click on Robot Operating System (ROS) to connect your model to ROS. The ROS Toolbox section should now appear under simulation.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-12-22 14:21:27 -0600

Seen: 641 times

Last updated: Nov 20 '19