Generated ROS node from Simulink, does not work on the target ROS device when launching it manually from Linux terminal without Simulink

1 view (last 30 days)
Dear Mathworks Community,
I am using Simulink R2020a. I have designed a Simulink model that I wanted to be deployed and run on a ROS device. I am using the virtual machine, provided by Mathworks, that come preconfigured with ROS.
when using the first method,build and run directly from simulink, automatically the ROS node is generated succesfully and the real robot achieve the desired motion accordingly.
When using the second method of deployment, generate the node from simulink then transfer the tgz file to the ROS device and built it there to become an executable package, the robot does not move after the running the node from the linux terminal. The node generated from Simulink was built successfully on the ROS device. Even though when I run the node, no errors popup and I can see the name of the node when typing rosnode list, and I can also visuliaze it in the ROS graph in rqt . This means that the node is actually active, but why the robot does not move at all like the first method ?
the name of the node generated from simulink is "robot_test", to run the node directly from the ROS device, I type in the linux terminal :
rosrun robot_test robot_test_node.
I highly appreciate your help and thank you in advance
  3 Comments

Sign in to comment.

Answers (1)

Josh Chen
Josh Chen on 7 Nov 2022
Hi JF,
Other quick things to try are:
1. Check whether the Gazebo world has been reset or not. Sometimes you may need to reset Gazebo. You can do this by Ctrl+R or click Edit > Reset World.
2. Run the following command on a new terminal on Linux and check whether expected messages has been published. Replace <topic-name> by the topic the generated node is publishing to (may also worth checking whether Gazebo is publishing any message).
$ source /opt/ros/noetic/setup.bash
$ rostopic echo <topic-name>
Please also forward this information when you reach out to MathWorks Techncial Support.
Thanks,
Josh

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!