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

android: how do i set ros hostname and master uri programatically inside code?

asked 2018-11-05 06:24:07 -0500

bhattarairazu gravatar image

updated 2018-11-05 06:56:47 -0500

gvdhoorn gravatar image

I want to set ros hostname and ros master uri inside the code manually.When i open ros activity in ros android it asks to enter ros master uri but i want to internally put the ros master uri inside code.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-11-05 06:54:19 -0500

jubeira gravatar image

updated 2018-11-05 06:56:17 -0500

Hi @bhattarairazu,

Take a look at the code of RosActiviy class. There is a constructor that accepts a custom master URI. If you extend RosActivity and you call this custom URI constructor, the ROS activity should skip the call for the MasterChooser: https://github.com/rosjava/android_co... .

Then, you can use getMasterURI method in your activity to retrieve the address that you specified in the first place. Note that the master URI is not set in the node itself, but in the configuration you use to actually execute the node. You can take at the pubsub tutorial for reference: https://github.com/rosjava/android_co... .

Hope it helps!

edit flag offensive delete link more

Comments

Hello @jubeira, I tried setting uri in the constructor and as you said i use getMasterURI method as well but it shows illegallStateException error in android. My code looks like this:

public DefaultAdd() {

    super("Defaults Adds", "Default Add",URI.create("http://192.168.0.108:11311"));

}

bhattarairazu gravatar image bhattarairazu  ( 2018-11-05 23:52:30 -0500 )edit

What is the cause of the error in the stack trace? Do you have a ROS master running in that URI when you start the app?

jubeira gravatar image jubeira  ( 2018-11-06 06:27:08 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-11-05 06:24:07 -0500

Seen: 513 times

Last updated: Nov 05 '18