How to put data into a ROS mssage with Array Buses

3 views (last 30 days)
when publish a topic with Array Buses inside the messagetype in Simulink, there's no way to put data into the array buses. I tried many solutions to put the data into the array buses, finally, when typing rostopic echo the topic ,data is NAN.Like the example below: I tried many ways to put data into "Points",including combine a array buses to the port or use a blank messagetype Point32 to transmit the data; when I put data directly into Points.X, there's an error remand me can not replace the signal within an array buses; but all failed. Hope to find a solution to solve this problem.Thanks a lot.
arraystructure.png

Answers (1)

Cam Salzberger
Cam Salzberger on 28 Oct 2019
Hello Xiaobo,
I believe that the recommended workflow (or at least the easiest) is to simply use a MATLAB Function block to do the assignment of values to a nested array message. See this example for an example model you can use as reference. Don't forget to manage the array sizes as well for variable-length arrays.
-Cam

Categories

Find more on Publishers and Subscribers in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!