rosjava / android_core

Android libraries for rosjava
145 stars 166 forks source link

Sending message from linux machine to android ROS subscriber doesn't work #316

Closed iKuba closed 4 years ago

iKuba commented 4 years ago

Hello,

I am trying to send a command via rostopic pub from my linux machine to an android device. The device is connected via USB. I am able to rostopic echo several topics being published from the device but the converse doesn't seem to hold true...

This is using rosjava + ROS Kinetic. I am 95% confident that the callback isn't being executed on the android device because I am not seeing any logs from the callback. I also know that the callback is being registered.

ernestmc commented 4 years ago

Make sure the host is resolvable from the android device. Try defining the ROS_IP and ROS_HOSTNAME as explained here

iKuba commented 4 years ago

This might be a silly question.. but how would I set the ROS_IP on the android device?

ernestmc commented 4 years ago

You need to set it on your host computer. Per the link I sent you:

When a ROS node advertises a topic, it provides a hostname:port combination (a URI) that other nodes will contact when they want to subscribe to that topic. It is important that the hostname that a node provides can be used by all other nodes to contact it.

If you want to subscribe to a topic your host computer is advertising, you need to make sure that the address that node is advertising is resolvable by the device that wants to subscribe.

iKuba commented 4 years ago

Cool that worked thanks! Thought I was already setting it...

On Tue, Mar 10, 2020 at 5:27 AM Ernesto Corbellini notifications@github.com wrote:

You need to set it on your host computer. Per the link I sent you:

When a ROS node advertises a topic, it provides a hostname:port combination (a URI) that other nodes will contact when they want to subscribe to that topic. It is important that the hostname that a node provides can be used by all other nodes to contact it.

If you want to subscribe to a topic your host computer is advertising, you need to make sure that the address that node is advertising is resolvable by the device that wants to subscribe.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rosjava/android_core/issues/316?email_source=notifications&email_token=AAWHX3LL6OE3A5PYWAUWAZTRGYW2NA5CNFSM4LDKZ5B2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOLGMYQ#issuecomment-597059170, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWHX3IWTH4M3CO2NJMW4U3RGYW2NANCNFSM4LDKZ5BQ .

-- Regards, Jakub Dworakowski