Clear Filters
Clear Filters

Index exceeds array dimensions in Write Point Cloud block ROS2

1 view (last 30 days)
I'm looking to generate a point cloud message from a UAV scenario LiDAR and send it to ROS2, but I keep encountering this persistent error.
Index exceeds array dimensions. Index value 133 exceeds valid range [1-128]. Code generation does not support growing arrays via indexing except by using end+1.
Error in WritePointCloudFcnBlock.m (line 100)
Data(Inds(1 : NumBytesArray(idx), :) + byteOffset) = typecast(XYZunordered(:, 1), 'uint8');
This is my model. My point cloud is unorganized and has dimensions of (18,000, 3).
Interestingly, when I utilize a constant block and provide it with data like [[0, 0, 0]; [1, 1, 1]], it functions without any issues. Could you guide me how to fix this.

Accepted Answer

Jarunyawat Buasri
Jarunyawat Buasri on 12 Aug 2023
So, I gave it a shot – trying to read a point cloud from Gazebo. That's when I stumbled upon something interesting in the ROS toolbox: the Variable Size Message. By tweaking the maximum length to over 128, I managed to get it working like a charm.

More Answers (0)

Categories

Find more on Specialized Messages in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!