Simulink codegen(with ROS2 Node) output error

6 views (last 30 days)
Rahul
Rahul on 13 Feb 2024
Answered: Josh Chen on 13 Feb 2024
I have generated code with a simple controller in Simulink model with a ROS2 node within it. After I build it manually(On my Linux machine) ,there is successful communication b/w diff nodes and the output is perfect. However, upon terminating the nodes and attempting to rerun the identical build file, now connected to the same ROS node, the output becomes significantly incorrect. Even rebuilding and running the file doesn't rectify the issue. Strangely, after restarting my Linux computer, rebuilding, and running the file again, everything operates perfectly once more

Answers (1)

Josh Chen
Josh Chen on 13 Feb 2024
Hi Rahul,
It is hard to tell what's going on based on the description. When this happens, were you able to launch the generated node without any warning/error?
I think couple things you can try for finding the culprit are:
  1. After killing the node with 'Ctrl+C', check with 'ros2 node list' to see if there's any unexpected node available on the network
  2. Is this related to some other nodes in the same domain? You may try to run the node under another domain ID to verify this.
  3. After restarting, and terminating again, if you rerun, did it still give you the wrong value?
If the above steps still can't find the root cause, please provide more information (reproduction steps, deployment environment, MATLAB versions) through MathWorks Technical Support, and we can look closer into this issue.
Thanks,
Josh

Community Treasure Hunt

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

Start Hunting!