Tutorials/CloudSim/1.3/ros connectivity

Introduction === This tutorial covers the steps to verify the network and ROS communication among simulator machine, field computer machine and Operator Control Unit (OCU).

Prerequisites === This tutorial assumes: You have started a VPC trio constellation in the Cloud with Gazebo running, that you have a Virtual Private Network running. See the related tutorials:
 * Start a VPC trio constellation
 * Connecting to a cloud simulation with a Virtual Private Network

Start the Gazebo simulator on a VPC trio constellation ===
 * Start a VPC trio constellation

Start the Virtual Private Network ===
 * Connecting to a cloud simulation with a Virtual Private Network

Connect to the field computer via ssh and set the ROS environment ===
 * Using the field computer VPC trio constellation

Connect to the simulator machine via ssh and set the ROS environment ===

Download the simulator computer's keys and execute the ssh script to log on to the simulator computer:

$ unzip ~/Downloads/simulator_cxe488142c.zip $ simulator_cxe488142c/simulator_ssh.bash

Set the ROS environment on your local machine (OCU) ===

Download the router's keys:

unzip ~/Downloads/router_cxe488142c.zip

Source the provided router_cxe488142c/ros.bash file that sets your ROS environment and sets the simulator machine as the ROS master:

. router_cxe488142c/ros.bash

Test ROS connectivity ===

In this type of constellation, a common use case is to subscribe to some topics published by the simulator, process some data, and then publish the results to the OCU (for example, to know the position of a relevant object). Other common scenario is to subscribe to the OCU commands, process some data, and then send a new set of topics to the simulator (for example, to move the robot). This section will verify the communication and ROS environment among all the machines.

On the OCU, listen to the topic /mychatter:

$ rostopic echo mychatter

On the field computer, listen to the topic /chatter and republish into the topic /mychatter: $ rostopic echo chatter | rostopic pub mychatter std_msgs/String

On the simulator machine, publish some messages into the topic /chatter: $ rostopic pub chatter std_msgs/String HelloVRC -r 1

You will see on the field computer machine:

publishing and latching message for 3.0 seconds publishing and latching message for 3.0 seconds publishing and latching message for 3.0 seconds publishing and latching message for 3.0 seconds

You will see on the OCU machine:

data: HelloVRC --- data: HelloVRC --- data: HelloVRC --- data: HelloVRC ---

Now, let's test the connectivity on the other direction:

On the SIM, listen to the topic /mychatter2:

$ rostopic echo mychatter2

On the field computer, listen to the topic /chatter2 and republish into the topic /mychatter2: $ rostopic echo chatter2 | rostopic pub mychatter2 std_msgs/String

On the OCU, publish some messages into the topic /chatter2: $ rostopic pub chatter2 std_msgs/String HelloVRC -r 1

You will see on the field computer machine:

publishing and latching message for 3.0 seconds publishing and latching message for 3.0 seconds publishing and latching message for 3.0 seconds publishing and latching message for 3.0 seconds

You will see on the SIM machine:

data: HelloVRC --- data: HelloVRC --- data: HelloVRC --- data: HelloVRC ---


 * 1) Next ##


 * Use gzclient on your local machine to connect to a cloud simulation