How to put data into a ROS mssage with Array Buses

3 visualizaciones (últimos 30 días)
xiaobo Li
xiaobo Li el 28 de Oct. de 2019
Respondida: Cam Salzberger el 28 de Oct. de 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

Respuestas (1)

Cam Salzberger
Cam Salzberger el 28 de Oct. de 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

Categorías

Más información sobre Publishers and Subscribers en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by