Robotics StackExchange | Archived questions

Matlab subscriber dont receive the ros publisher message

Hello,

I started the turtlesim and turtleteleopkey 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 turtleteleopkey

(Matlab)

-> node = rosmatlab.node('node','localhost:11311') %I cant post links

-> subscriber = node.addSubscriber('turtle1/cmdvel' , 'geometrymsgs/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

Asked by Eskarppelli on 2014-04-07 04:35:32 UTC

Comments

Answers