Clear Filters
Clear Filters

How do I troubleshoot ROS 2 communication issues between Simulink and Foxy in R2022b?

7 views (last 30 days)
I have created a publisher with a custom topic called "my_topic" using Simulink:
In MATLAB R2022b, I am able to see the topic by executing the following command
ros2 topic list
which produces the following output
/my_topic
/parameter_events
/rosout
However, I am unable to see "my_topic" when using the same command in the ROS 2 Foxy command prompt.
How can I see "my_topic" from the command prompt?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 8 Sep 2023
In order to troubleshoot the issue, you can follow the steps below:
1) Confirm that "ROS_DOMAIN_ID" is set to 112 from both the MATLAB R2022b Command Window and the ROS 2 Foxy command prompt.
In particular, using the ROS 2 Foxy command prompt, set "ROS_DOMAIN_ID" outside MATLAB using the command
set ROS_DOMAIN_ID=112
and then check that the ID is correctly set using the command
echo %ROS_DOMAIN_ID%
Then, to see the list of topics in the ROS 2 Foxy command prompt, execute the command
ros2 topic list
a few times in case you do not see topics for the first time on that particular domain ID.
2)  If the topic list still does not contain the topic of interest "my_topic", execute the following commands in the ROS 2 Foxy command prompt
ros2 daemon stop 
ros2 topic list
to see if the topic appears in the list.
3)  If the topic list still does not contain the topic of interest "my_topic", delete all possible files from the folder where the ROS 2 Fast-DDS specific cache files are located. Ignore the ones that cannot be deleted, as they are locked by the ROS 2 node running in MATLAB R2022b.
Then, in the ROS 2 Foxy command prompt execute the commands below
ros2 daemon stop
ros2 topic list
to see if the topic appears in the list.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!