How to put data into a ROS mssage with Array Buses

3 Ansichten (letzte 30 Tage)
xiaobo Li
xiaobo Li am 28 Okt. 2019
Beantwortet: Cam Salzberger am 28 Okt. 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

Antworten (1)

Cam Salzberger
Cam Salzberger am 28 Okt. 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

Kategorien

Mehr zu Publishers and Subscribers finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by