Ask Your Question
1

Android Problem Subscribing to a custom message

asked 2012-09-27 23:23:06 -0500

JMata gravatar image

updated 2012-09-28 07:49:34 -0500

Hello all!

I am having problems when creating a new subscriber to a custom message in my android app. I have the same code in a java project and works ok showing the information message in the terminal.

The estrange thing is that there are another subscriber running just in the same code.

The error log is:

E/UpdatePublisherRunnable(4793): java.lang.RuntimeException: java.net.UnknownHostException: Unable to resolve host "arturo-desktop": No address associated with hostname

I create the subscriber this way:

Subscriber<meta_msgs.NodesList> subscriber2 = connectedNode.newSubscriber("nodes_list", meta_msgs.NodesList._TYPE);
    subscriber2.addMessageListener(new MessageListener<meta_msgs.NodesList>() {
        @Override
        public void onNewMessage(meta_msgs.NodesList message) {
            Toast.makeText(getContext(), "OK. Message Received!!!", Toast.LENGTH_SHORT).show();
        }
      });

My custom message is composed of custom messages too. Here are the codes:

NodesList.msg:

Header header #for timestamp
NodeInfo[] nodes # an array of the nodes

NodeInfo.msg:

# This message holds info of a ROS node
# 

# Possible levels of operations
byte OK=1
byte ERROR=0

string node_name # the name of the node
byte status # status of the ros node regarding master connectivity
ROSTopic[] subs
ROSTopic[] pubs
ROSParameter[] params # the parameters of the node
string[] errors # latest history of relevant messages sent to rosout from the node

ROSParameter.msg:

string type # see OMTypes.msg for values
string name
uint8[] value

ROSTopic.msg:

string name # name of the topic
string type # type of the message

OMTypes.msg:

# Python format characters are used to simplify the Python code
string INTEGER=i    
string STRING=64p
string DOUBLE=d

Does anybody have problems when trying custom messages with Android? Thanks! Its very important for me!

edit retag flag offensive close merge delete

Comments

What's the error you get? Make sure you have a look at the support guidelines. Just saying "I'm having problems" unfortunately doesn't give us enough information to infer the error.

Lorenz gravatar imageLorenz ( 2012-09-27 23:43:31 -0500 )edit

Thanks for ask! the error log is: E/UpdatePublisherRunnable(4793): java.lang.RuntimeException: java.net.UnknownHostException: Unable to resolve host "arturo-desktop": No address associated with hostname

JMata gravatar imageJMata ( 2012-09-28 03:10:48 -0500 )edit

It doesn't look like this error has anything to do with the message. Where is your ROS core running? What's the master uri you are using? Btw. please edit your question and the exception in a readable format.

Lorenz gravatar imageLorenz ( 2012-09-28 03:15:54 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2012-09-28 04:40:44 -0500

Lorenz gravatar image

My guess is that the problem does not have anything to do with your custom message. Instead, I guess it is a network problem.

I assume that you have a publisher with your custom message running on a PC (host name arturo-desktop), but you didn't set the variable ROS_IP on the PC. The publisher will then advertise using the PC's hostname and the android device doesn't know about that hostname. Have a look at the network setup page.

edit flag offensive delete link more
0

answered 2012-09-28 03:29:11 -0500

JMata gravatar image

My ROS core is running in my PC and i launch the subscriber node from my android tablet. This error log only appears when i try my subscriber to custom message. If i try it to a std_msgs.String for example it works. My master uri is well defined because i can check it when debugging the app. it looks like: http://localhost:11311 where local host is: 138.100.76.196 and is named: arturo-desktop I don't know why this error only begins with this subscriber. Any suggestion? Thanks for helping!!

edit flag offensive delete link more

Comments

Please do not create answers for comments or discussion. Instead please edit your original question or use the comment functionality. This site is not a forum.

Lorenz gravatar imageLorenz ( 2012-09-28 04:31:15 -0500 )edit

Sorry for that, but i needed more words than the comment let me wrote.

JMata gravatar imageJMata ( 2012-09-28 06:47:54 -0500 )edit

Then please edit your original post.

Lorenz gravatar imageLorenz ( 2012-09-28 08:03:48 -0500 )edit

I use the android_tutorial_pubsub sent massage to my PC ,its std_msgs.String. But my PC didn`t receive any message from my android phone . you says that "If i try it to a std_msgs.String for example it works". What is the code on your PC ?

C.J. gravatar imageC.J. ( 2013-09-09 01:56:09 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-09-27 23:23:06 -0500

Seen: 2,047 times

Last updated: Sep 28 '12