|Note: This tutorial assumes that you have completed the previous tutorials: Standalone App Manager.|
|Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.|
Pairing ModeDescription: Launching the robot app manager for pairing through a public master.
Keywords: pairing, robot app manager,
Tutorial Level: INTERMEDIATE
Next Tutorial: Pairing with Androids
This tutorial shows how to setup and run the rocon app manager in pairing mode with a small walkthrough introducing the private/public masters and remote controlling workflow. Read through the design notes on pairing to get a better understanding of what follows.
Follow the instructions for installation of the rocon stacks.
> rocon_launch rocon_app_manager paired.concert
rocon_launch is a multimaster version of roslaunch. In this case, it launches two linux shells (gnome-terminal or konsole) which spawn the following ros master environments:
Software: This master runs just the rocon gateway and robot app_manager with a few default software (only rapps, e.g. chirp, talker, ...). This would usually be where the rest of your robot software will run. It is hidden from the outside world.
Software: This master runs another rocon gateway and a simple pairing script that assists the invitation of the private app manager and flipping the appropriate topics back and forth between the two masters. Think of it as the public sandbox.
Open a new shell and drop into the public master.
> export ROS_MASTER_URI=http://localhost:11311
Here you will find various handles from the private master's app manager have been flipped across under a unique namespace (thanks to a uuid suffix), e.g.:
> rosservice list /cybernetic_pirate77f1d6963dc748f79efbc52718409734/invite /cybernetic_pirate77f1d6963dc748f79efbc52718409734/list_apps /cybernetic_pirate77f1d6963dc748f79efbc52718409734/pairing_mode_invite /cybernetic_pirate77f1d6963dc748f79efbc52718409734/platform_info /cybernetic_pirate77f1d6963dc748f79efbc52718409734/status
Note: Make sure you replace the UUIDs in the commands shown hereafter.
You can query the list apps service or topic to see what the app manager has to offer, in this case. Make sure you ungrep the keyword 'data' to avoid bringing in the byte array that is representative of the app's icon:
> rostopic echo /cybernetic_pirate77f1d6963dc748f79efbc52718409734/app_list | grep -v data
Note however that there is no start_app or stop_app yet. The app manager first has to be invited (query the status service to determine its current state) and if it is not already busy, it will then permit this public master to be the remote controller. Before we do that however, we will disable the cleanup watchdog. The watchdog is useful if you're connecting with an android and the android crashes - this will release the invitation after a timeout, but for our purposes, we'll do things manually.
> rostopic pub /pairing_master/watchdog std_msgs/Bool "data: False" > rosservice call /pairing_master/invite "cancel: false"
Just use tab-tab to fill out the defaults to this service call. This will relay an invitation to the app manager along with the public master's unique gateway name (for identification purposes). Now you will notice start_app in your services list!
> rosservice call /cybernetic_pirated77f1d6963dc748f79efbc52718409734/start_app rocon_apps/chirp 
Finally release the invitation:
> rosservice call /pairing_master/invite "cancel: true"
Ok, doing everything by command line is rather cumbersome, but that is not what this environment is really intended for. It is designed for convenient access and that is where Pairing with Androids comes in! It will do alot of the hard work for you.