Manage Ros Custom Message with Variable-Length array
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi
I'm trying to read a message from ROS that is structured like this
The message is called WaypointArray.msg and contains header, two booleans and an array of Waypoints
Every waypoint has the fields x and y
I'm trying to read them following the example of reading variable-length array from ros but i cannot manage to find a solution. I place a bus selector to select the Array field and the count, a selector to select the indexes and now I have a variable length array of buses. I cannot make it work with nothing, if I place another bus selector to get the X field it tells me that it cannot work with variable length buses, the same if i place a "to workspace" field.
Is there a block in simulink to select and work the fields from the array elements? What I want at the end is like a 2xN matrix with the x and y element from every waypoint
Thank you!
0 Kommentare
Antworten (1)
Josh Chen
am 24 Nov. 2020
Bearbeitet: Josh Chen
am 24 Nov. 2020
Hi Marco,
It's a bit difficult to see the full picture without a model, but if I understand correctly, you've already managed to create this custom message, receive the message in Simulink, and extract the array out through bus selector. And you are looking for a way to return this waypoint array in the message as a 2xN matrix?
If the above description sounds right, I would recommend you use a MATLAB Function block. This block gives you the flexibility to extract and postprocess the array data just as what you can do in MATLAB. This example of using MATLAB Function block with Simulink ROS messages might be helpful.
Hope this helps,
Josh
0 Kommentare
Siehe auch
Kategorien
Mehr zu Specialized Messages finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!