MATLAB Answers

How to put data into a ROS mssage with Array Buses

2 views (last 30 days)
xiaobo Li
xiaobo Li on 28 Oct 2019
Answered: Cam Salzberger on 28 Oct 2019
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

  0 Comments

Sign in to comment.

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

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags