0
$\begingroup$

Rosanswers logo

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!


Originally posted by JMata on ROS Answers with karma: 30 on 2012-09-27

Post score: 1


Original comments

Comment by Lorenz on 2012-09-27:
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.

Comment by JMata on 2012-09-28:
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

Comment by Lorenz on 2012-09-28:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Lorenz with karma: 22731 on 2012-09-28

This answer was ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.