Matlab subscriber dont receive the ros publisher message
Hello,
I started the turtlesim and turtle_teleop_key like the tutorial says to, then I started the matlab subscriber and made the connection. When I look at the information from the topic(@rostopic info), the connection seems to work, but my subscriber is not receiving messages posted to the topic. Does anyone know what could be the problem?
Code used: (ROS)
$ roscore
$ rosrun turtlesim turtlesim_node
$ rosrun turtlesim turtle_teleop_key
(Matlab)
-> node = rosmatlab.node('node','localhost:11311') %I cant post links
-> subscriber = node.addSubscriber('turtle1/cmd_vel' , 'geometry_msgs/Twist',1)
-> message = getmessage();
-> subscriber.setOnNewMessageListeners({ @message.set_mes});
classdef getmessage < handle
properties
message
end
methods
function obj = getmessage()
disp('Message Created')
end
function set_mes(obj, mes)
obj.message = mes;
end
function ret = get_mes(obj)
ret = obj.message;
end
end
end
Thanks