Note: This tutorial assumes that you have completed the previous tutorials: rocon_app_utilities/Tutorials/indigo/Install Rapps. |
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. |
Automatic Rapp Installation
Description: Enable to app manager to automatically install rappsTutorial Level: INTERMEDIATE
Contents
Overview
The app manager has the ability to automatically install rapps. Precisely speaking, the app manager does not install a rapp, but only its dependencies, since a rapp contains only meta information.
In order to enable automatic rapp installation you have to give apt-get extra permission to run without providing a password. For enabling this, we will modify the so called sudoers file. Be advised, that this represents a security risk.
Sudoers
To modify your sudoers file, you need to use the tool called visudo.
$ sudo visudo
Now add the below at the last line of the sudoers file.
turtlebot ALL=(ALL) NOPASSWD: /usr/bin/apt-get
Make sure to replace turtlebot with your (Ubuntu) username.
App Manager
Next, we modify a launch parameter for the app manager to notify it, that automatic app installation has been enabled.
Create a custom launcher which includes the rocon app manager as outlined in the previous tutorial with auto_rapp_installation set to true.
<launch> <include file="$(find rocon_app_manager)/launch/standalone.launch"> <arg name="auto_rapp_installation" default="true"/> </include> <!-- ...other arg settings... --> </launch>
Install a rapp
Installing a rapp is now simple. The app manager will take care of this, when it is order to start a rapp, which hasn't been installed yet.
Example
On app manager startup you can notice:
[INFO] [WallTime: 1398070966.808684] App Manager : determining runnable rapps... [INFO] [WallTime: 1398070968.811526] Request to establish a bond [INFO] [WallTime: 1398070969.828254] Bond formed with bond_id of 'b62ca446-c933-11e3-ae37-f46d04929542' [INFO] [WallTime: 1398070969.837240] Servicing request for capability specs... [INFO] [WallTime: 1398070969.932572] App Manager : determining installed rapps... [INFO] [WallTime: 1398070970.339681] App Manager : 'kobuki_apps/auto_docking' added to the list of installable apps. [INFO] [WallTime: 1398070970.340018] App Manager : 'kobuki_apps/random_walker' added to the list of installable apps. [INFO] [WallTime: 1398070970.340203] App Manager : 'rocon_apps/listener' added to the list of runnable apps. [INFO] [WallTime: 1398070970.340355] App Manager : 'rocon_apps/chirp' added to the list of runnable apps. [INFO] [WallTime: 1398070970.340508] App Manager : 'rocon_apps/talker' added to the list of runnable apps. [INFO] [WallTime: 1398070970.359242] App Manager : initialised.
Notice that kobuki_apps/auto_docking and kobuki_apps/random_walker have been identified as installable.
Next, we request to start the app kobuki_apps/random_walker.
$ rosservice call /kobuki/start_app "name: 'kobuki_apps/random_walker' remappings: - remap_from: '' remap_to: ''"
If automatic app installation hasn't been enabled yet, you will see the following:
[INFO] [WallTime: 1398071161.446732] App Manager : Request received to start app 'kobuki_apps/random_walker' [WARN] [WallTime: 1398071161.447150] App Manager : Rapp 'kobuki_apps/random_walker' can be installed, but automatic installation is not enabled. Please refer to 'http://wiki.ros.org/rocon_app_manager/Tutorials/indigo/Automatic Rapp Installation' for instructions on how to set up automatic rapp installation.
If automatic app installation has been enabled, you will see the following:
[INFO] [WallTime: 1398071820.448665] App Manager : Request received to start app 'kobuki_apps/random_walker' [INFO] [WallTime: 1398071820.449137] App Manager : Installing rapp 'kobuki_apps/random_walker' executing command [sudo apt-get install ros-hydro-kobuki-random-walker] Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: erlang-xmerl ros-hydro-libg2o libmozjs185-1.0 ros-hydro-kobuki-controller-tutorial couchdb-bin erlang-runtime-tools erlang-mnesia erlang-public-key erlang-inets ros-hydro-opencv-candidate ros-hydro-ecto-image-pipeline couchdb erlang-ssl ros-hydro-kobuki-testsuite ros-hydro-ecto-opencv Use 'apt-get autoremove' to remove them. The following NEW packages will be installed ros-hydro-kobuki-random-walker 0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade. Need to get 0 B/62.7 kB of archives. After this operation, 305 kB of additional disk space will be used. dpkg-preconfigure: Unable to re-open stdin: No such file or directory Selecting previously unselected package ros-hydro-kobuki-random-walker. (Reading database ... 1138679 files and directories currently installed.) Unpacking ros-hydro-kobuki-random-walker (from .../ros-hydro-kobuki-random-walker_0.5.5-1precise-20140325-0110-+0000_amd64.deb) ... Setting up ros-hydro-kobuki-random-walker (0.5.5-1precise-20140325-0110-+0000) ... [INFO] [WallTime: 1398071826.783870] App Manager : Rapp 'kobuki_apps/random_walker' has been installed.