ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi @ByteMonster,

To publish messages, you need to create and execute a node. Within the context of the node execution, you can get a publisher and start doing what you want. I'd definitely not go the way of Java sockets in this case; you can use RosJava.

I've created a minimal example app to show the point. You can take a look here: https://github.com/jubeira/ros_android_helloworld, and in particular, at the main activity.

Note that the nodes you create should extend AbstractNodeMain, and the user code should always be in its onStart method. The ConnectedNode received by that method will provide you with methods to create publishers and so on.

Hope it helps!

Hi @ByteMonster,

To publish messages, you need to create and execute a node. Within the context of the node execution, you can get a publisher and start doing what you want. I'd definitely not go the way of Java sockets in this case; you can use RosJava.

I've created a minimal example app to show the point. You can take a look here: https://github.com/jubeira/ros_android_helloworld, and in particular, at the main activity.

Note that the nodes you create should extend AbstractNodeMain, and the user code should always be in its onStart method. The ConnectedNode received by that method will provide you with methods to create publishers and so on.

Hope it helps!

Edit: You can also take a look at the 'official' code samples in Android Core. The most basic example there is this one: https://github.com/rosjava/android_core/tree/kinetic/android_tutorial_pubsub, which is just a bit more advanced than the one I posted above.