In this lesson we will write user side of rocon application. We will learn how to add follower application in application list.

Prerequisites

This lesson is a continuation of the previous lesson: “Multiple TurtleBots in Concert”. If you have not done this lesson, do it firstly.

Creating interaction

1. Create interactions folder in my_rapps.

cd ~/my_ws/src/my_rapps/
mkdir interactions
cd ineractions

2. Create my.interactions file with following content:

- name: ""
  role: My Interactions
  compatibility: rocon:/pc/*/hydro|indigo/precise|quantal|raring|saucy|trusty
  display_name: Follower
  description: Take the TurtleBot for a stroll. TurtleBot will follow  whatever is in front of it.
  max: -1
  icon:
    resource_name: my_rapps/follower_bubble_icon.png
  pairing:
    rapp: my_rapps/follower
    remappings: []

Modifying concert_service_gazebo Package

1. Clone concert_services.

cd ~/my_ws/src/
git clone https://github.com/robotics-in-concert/concert_services.git

2. Change directory.

cd ~/my_ws/src/concert_services/

3. Change git branch.

git checkout indigo

3. Edit robot.launch file.

cd concert_service_gazebo/launch/

Add robot_interactions and robot_interactions_list arguments below robot_concert_whitelist and above include tag.

<arg name="robot_interactions" default="false"/>
<arg name="robot_interactions_list" default="[]"/>

Add interactions and interactions_list arguments below concert_whitelist and inside include tag.

<arg name="interactions" value="$(arg robot_interactions)"/>
<arg name="interactions_list" value="$(arg robot_interactions_list)"/>

4. Edit gazebo_robot_manager.py file.

cd ~/my_ws/src/concert_services/concert_service_gazebo/src/concert_service_gazebo/

Add two strings in _prepare_rocon_launch_text function

launch_text += '    <arg name="robot_interactions" value="%s"/>\n' % robot['interactions']
launch_text += '    <arg name="robot_interactions_list" value="%s"/>\n' % str(robot['interactions_list'])

above this string

launch_text += '  </launch>'

We edit this file for using robot_interactions and robot_interactions_list parameters.

Modifying gazebo_concert Package

1. Edit gazebo.parameters file.

cd ~/my_ws/src/rocon_tutorials/concert_tutorials/gazebo_concert/solutions/

Add interactions and interactions_list for each robot.

interactions: true
interactions_list: [turtlebot_bringup/documentation.interactions, my_rapps/my.interactions]

2. Build package.

source /opt/ros/indigo/setup.bash
cd ~/my_ws/
catkin_make

Running Follower Application

1. Change the path.

source ~/my_ws/devel/setup.bash

2. Launch gazebo_concert.

roslaunch gazebo_concert concert.launch

You will see these strings in each robot terminal.

[INFO] [WallTime: 1456371595.581037] [10.320000] Interactions : loading Follower [-My Interactions-/]

3. Start rocon_remocon.

rocon_remocon

4. Select Gazebo Concert->User->Gazebo Viewer.

You will see the familiar Gazebo world.

5. Select Concert Teleop in Interactions Chooser.

6. Select gamza1 in the resource list and capture it.

7. In a new terminal start rocon_remocon.

rocon_remocon

8. Press Add. Edit MASTER_URI.

MASTER_URI = http://localhost:11412

Remocon Add Master

9. Press Add. You will see ros master gamza2.

Remocon Master List

10. Select gamza2.

11. Select My Interactions.

Remocon Role Chooser

12. Select Follower.

Remocon Interactions Chooser

13. Drive gamza1 using joystick to initiate following behavior.

14. Interrupt the processes. Close the windows.

You can watch these steps in the video:

Writing Your First Interaction