Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Add functionality to bypass the MasterChooserActivity#233

Merged
stonier merged 1 commit intorosjava:indigofrom
rking788:ft-bypass-master-chooser
Mar 1, 2015
Merged

Add functionality to bypass the MasterChooserActivity#233
stonier merged 1 commit intorosjava:indigofrom
rking788:ft-bypass-master-chooser

Conversation

@rking788
Copy link
Copy Markdown
Contributor

It may not always be necessary to present the MasterChooserActivity. This change allows the MasterURI to be specified via the RosActivity constructor. If none is provided, it will fallback to presenting the MasterChooser.

@stonier
Copy link
Copy Markdown
Contributor

stonier commented Feb 25, 2015

This is a nice idea that we've wanted for a while, been using workarounds instead...I'll have a look at it shortly.

@rking788
Copy link
Copy Markdown
Contributor Author

Sounds good. Thanks.

stonier added a commit that referenced this pull request Mar 1, 2015
Add functionality to bypass the MasterChooserActivity
@stonier stonier merged commit adee05d into rosjava:indigo Mar 1, 2015
@stonier
Copy link
Copy Markdown
Contributor

stonier commented Mar 1, 2015

No problems here. :neckbeard:

@stonier stonier added this to the Indigo milestone Mar 1, 2015
@stonier stonier self-assigned this Mar 1, 2015
@stonier
Copy link
Copy Markdown
Contributor

stonier commented Mar 1, 2015

@rking788 Could you write a brief tutorial on the RosActivity with a reference about the chooser/no chooser? Tutorial would go here. I'll redirect that information into android_core's sphinx api documentation once I've updated it for indigo (#234).

@rking788
Copy link
Copy Markdown
Contributor Author

rking788 commented Mar 4, 2015

Thanks for merging in those changes @stonier. Here is the requested wiki write-up

To Choose or Not to Choose?

There is now an optional way of bypassing the MasterChooser activity in android_core by providing a master URI to the RosActivity constructor.

The Master Chooser

Bundled into android_core is an Activity subclass named MasterChooser. This activity can be used to specify an existing ROS master node or start a new master node on the device. This activity is created and presented in the RosActivity constructor. The view for the MasterChooser contains an EditText field for entering the master node URI as well as a button to connect to the node. There are also some advanced options that can be used when creating a new master node on the device.

It is important to note that the MasterChooser needs to be declared in the application's manifest to avoid a crash. This can be done by adding the following line inside the tag.

<activity android:name="org.ros.android.MasterChooser" />

Avoiding the Master Chooser

There are cases where the master node URI can either be hardcoded into the application or it would be best to present a custom view for specifying the master node. This can be accomplished by providing a custom URI in the call to the RosActivity constructor. This will allow the application to use a RosActivity without presenting the MasterChooser.

As an example, to bypass the MasterChooser, the following code from the android_tutorial_pubsub MainActivity:

super("Pubsub Tutorial", "Pubsub Tutorial");

would be changed to something similar to:

super("Pubsub Tutorial", "Pubsub Tutorial", URI.create("http://localhost:11311"));

@stonier
Copy link
Copy Markdown
Contributor

stonier commented Mar 5, 2015

Awesome, can you add this to the wiki tutorial?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants