Android ros Subscriber自定义消息

时间:2012-09-28 09:31:13

标签: android ros

我在Android应用中为自定义消息创建新订阅者时遇到问题。我在java项目中使用相同的代码,并在终端中显示信息消息。

错误日志是:

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

我以这种方式创建订阅者:

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();
        }
      });

我的自定义消息也由自定义消息组成。以下是代码:

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

使用Android尝试自定义消息时是否有人遇到问题? 谢谢!这对我来说非常重要!

0 个答案:

没有答案