Why is the ROS subscriber callback in MATLAB not triggered when messages are published from an external ROS node (not in MATLAB)?
Show older comments
Reproduction steps:
ROS Master:
In Linux terminal,
$ roscore
Publisher:
In a new Linux terminal,
$ rostopic pub -r 2 /chatter std_msgs/String {}
Subscriber:
In MATLAB:
Node = rosmatlab.node('Test','http://localhost:11311');Sub = Node.addSubscriber('/chatter','std_msgs/String',10);Sub.setOnNewMessageListeners({@test_fun});
In a new file “test_fun.m”:
function test_fun(msg) disp('Message received!')end
With the above setup, no messages are received in MATLAB.
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with ROS Toolbox 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!