Publishing /diagnostics ros2 Topic in Simulink
Show older comments
Hello,
I am trying to publish a ROS2 diagnostics topic in Simulink. The topic uses the DiagnosticArray message type, which makes it difficult to use the Bus Assignment block. To address this, I created a custom function for the task. Here is the function I implemented:
function msg = assignNestedArrayMessages(blankMessage)
blankMessage.status_SL_Info.CurrentLength = uint32(2);
blankMessage.status(1).level = uint8(1);
blankMessage.status(2).level = uint8(2);
blankMessage.header.stamp.sec = int32(1);
msg =blankMessage;
end

However, despite the simplicity of the function, I encountered the following error:
One or more signal names in the input bus to block 'pp/pub_diagnostics/SignalSpecification' does not match the signal names in the bus specified by the bus object 'SL_Bus_diagnostic_msgs_DiagnosticArray' on the block dialog. Signal Specification blocks always treat element name mismatches as errors, regardless of the 'Element name mismatch' option setting. Either change the specified bus object or rename the input bus element signals to match the bus object.
I would appreciate it if you could provide guidance on how to resolve this issue.
Accepted Answer
More Answers (0)
Categories
Find more on ROS Network Access in Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!