Robotics StackExchange | Archived questions

Subscribe /ar_pose_marker in matlab

Hello, I am having a problem with matlab and ROS. I would like to subscribe /arposemarker in matlab but i am getting a error

Thats the Matlab code:

clear,close, clc;

%addpath(genpath('/home/Downloads/email'));
%addpath('/home/Downloads/email');

global pos;
 setenv('ROS_MASTER_URI','http://paulo-Inspiron-7537:11311')
 setenv('ROS_IP','192.168.1.2')

rosinit('http://paulo-Inspiron-7537:11311','NodeHost','192.168.1.2','NodeName','/teste')
camera = rossubscriber('/ar_pose_marker',@getPose);

Thats the error that I get:

Initializing global node /teste with NodeURI http://192.168.1.2:34676/
Error using qr_pose (line 13)
Failed to create a subscriber with topic name /ar_pose_marker and type ar_track_alvar_msgs/AlvarMarkers.

And if I try to do rostopic echo /arposemarker on matlab I also get these error:

>> rostopic echo /ar_pose_marker
Failed to create a subscriber with topic name /ar_pose_marker and type ar_track_alvar_msgs/AlvarMarkers.

There is no problem in ROS Linux terminal, the rostopic echo is working and also a Subscribe code that I made on cpp.

Does anybody have a clue ? Edit: I am using Kinetic on Ubuntu 16. Other things are working on matlab like subscribing /turtle1/pose Thanks for your help, I really appreciate it !!!

Asked by Paulo on 2017-03-04 18:48:15 UTC

Comments

Have you posted as much code as you can? I have a feeling you may have not, because I don't see where you're trying to use qr_pose.

Asked by 130s on 2017-04-18 21:48:16 UTC

Answers

hi guys

I have the same error. Anybody found a solution?

My connection with the ros master is successful. I can list the nodes and topics. However, the echoing gives me the 'Failed to create a subscriber error'.

The node that is publishing the topic I am trying to echo is running on a third computer (i.e. not the master and not my remote computer running matlab). This third computer has a hostname COMPUTER1. When I rosnode info the node that publishes the topic I want to monitor, it tells me the URI is [http://COMPUTER1:33117/]. The problem seems to be that COMPUTER1 is not recognized as an host or something. I already added COMPUTER1 and its IP address to C:\Windows\System32\drivers\etc. I am able to ping COMPUTER1 from a terminal.

Anybody has any idea what's going on here? Thank you Martine

Asked by martine on 2018-06-18 16:02:39 UTC

Comments