ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Okay here we go:

To clarify, this is what I believe your setup is:

  • Robot has ROS installed and has a cellular (3G/4G) dongle. It has a camera on board and you need to stream the image to multiple computers on a different network.
  • Server is publicly addressable (ie it has open ports on the internet, and you have the authority to open those ports). It does not have ROS installed. It will get the image from the robot's camera and make it publicly available. I will assume the server runs Ubuntu, you could adapt the commands below for Windows
  • Multiple clients do not have anything special installed, and need to view the camera stream.

On the cellular thing: I really think you'll get less than one frame per second with this setup.

Anyway, here is how I would set this up:

  1. On the server, open UDP port 1194 to the internet
  2. On the server, install OpenVPN with: sudo apt-get install openvpn
  3. On the server, generate one server key, one client key, and your diffie-hellman parameters using the instructions at: http://openvpn.net/index.php/open-source/documentation/howto.html#pki (note you'll need to get easyrsa from https://github.com/OpenVPN/easy-rsa)
  4. On the server, copy the server configuration file at http://openvpn.net/index.php/open-source/documentation/howto.html#server to a new file at: /etc/openvpn/server.conf
  5. On the server, update the ca cert key and dh fields in server.conf to match the keys you generated in step 2
  6. On the robot, download OpenVPN with: sudo apt-get install openvpn
  7. On the robot, copy the client configuration file at http://openvpn.net/index.php/open-source/documentation/howto.html#client to /etc/openvpn/client.conf
  8. On the robot, change "my-server" in the line "remote my-server-1 1194" to the public IP address of your server.
  9. On the robot, copy these files from the server to /etc/openvpn/: ca.crt, your-clients-name.crt, and your-clients-name.key (note this should be done in a secure way, ie on a flash drive, not over the internet)
  10. On both the server and robot run: sudo service openvpn restart to have them both connect through the VPN tunnel.
  11. To test the configuration: on the robot, ping the server with: ping 10.8.0.1, then on the server ping the robot with: ping 10.8.0.6. If one of these fails, let me know and we'll debug it.
  12. On the server, install mjpeg_server with sudo apt-get install ros-hydro-mjpeg-server
  13. Set up mjpeg_server to start streaming (I've never used it...but let me know if you have problems and we can take a look together). I'll continue under the assumption this is working and you can view the image by going to http://localhost:8080/stream?topic=/IMAGE_TOPIC
  14. On the server, go to: http://10.8.0.6:8080/stream?topic=/IMAGE_TOPIC and you should see the images. I'd suggest trialing this over Ethernet or WiFi before trying to use the cellular adapter

From here I assume you can figure out the streaming to clients part. You could either re-encode the stream before sending it to clients, or just set your server up so that when a client connects to port 8080 the traffic is redirected through the OpenVPN tunnel to 10.8.0.6. I believe this is pretty simple, just like redirecting any other kind of traffic similar to a WiFi access point does port forwarding.

And that's my simple 14-step process for robot to client video streaming :) Good luck, let me know if (and when) you run into any difficulties.

-Tim

Okay here we go:

To clarify, this is what I believe your setup is:

  • Robot has ROS installed and has a cellular (3G/4G) dongle. It has a camera on board and you need to stream the image to multiple computers on a different network.
  • Server is publicly addressable (ie it has open ports on the internet, and you have the authority to open those ports). It does not have ROS installed. It will get the image from the robot's camera and make it publicly available. I will assume the server runs Ubuntu, you could adapt the commands below for Windows
  • Multiple clients do not have anything special installed, and need to view the camera stream.

On the cellular thing: I really think you'll get less than one frame per second with this setup.

Anyway, here is how I would set this up:

  1. On the server, open UDP port 1194 to the internet
  2. On the server, install OpenVPN with: sudo apt-get install openvpn
  3. On the server, generate one server key, one client key, and your diffie-hellman parameters using Update: these directions are more accurate: Follow the instructions at: http://openvpn.net/index.php/open-source/documentation/howto.html#pki https://github.com/OpenVPN/easy-rsa/blob/master/README.quickstart.md to generate a server key and client key (note you'll need to get git easyrsa onto both machines from https://github.com/OpenVPN/easy-rsa)https://github.com/OpenVPN/easy-rsa). Put the keys and certificates you generate into the /etc/openvpn/ directory on each machine
  4. On the server, copy the server configuration file at http://openvpn.net/index.php/open-source/documentation/howto.html#server to a new file at: /etc/openvpn/server.conf
  5. On the server, update the ca cert key and dh fields in server.conf to match the keys you generated in step 2
  6. On the robot, download OpenVPN with: sudo apt-get install openvpn
  7. On the robot, copy the client configuration file at http://openvpn.net/index.php/open-source/documentation/howto.html#client to /etc/openvpn/client.conf
  8. On the robot, In that client.conf file, change "my-server" in the line "remote remote my-server-1 1194" 1194 to the public IP address of your server.
  9. On the robot, copy these files from the server to /etc/openvpn/: ca.crt, your-clients-name.crt, and your-clients-name.key (note this should be done in a secure way, ie on a flash drive, not over the internet)
  10. On both the server and robot run: sudo service openvpn restart to have them both connect through the VPN tunnel.
  11. To test the configuration: on the robot, ping the server with: ping 10.8.0.1, then on the server ping the robot with: ping 10.8.0.6. If one of these fails, let me know and we'll debug it.
  12. On the server, install mjpeg_server with sudo apt-get install ros-hydro-mjpeg-server
  13. Set up mjpeg_server to start streaming (I've never used it...but let me know if you have problems and we can take a look together). I'll continue under the assumption this is working and you can view the image by going to http://localhost:8080/stream?topic=/IMAGE_TOPIC
  14. On the server, go to: http://10.8.0.6:8080/stream?topic=/IMAGE_TOPIC and you should see the images. I'd suggest trialing this over Ethernet or WiFi before trying to use the cellular adapter

From here I assume you can figure out the streaming to clients part. You could either re-encode the stream before sending it to clients, or just set your server up so that when a client connects to port 8080 the traffic is redirected through the OpenVPN tunnel to 10.8.0.6. I believe this is pretty simple, just like redirecting any other kind of traffic similar to a WiFi access point does port forwarding.

And that's my simple 14-step process for robot to client video streaming :) Good luck, let me know if (and when) you run into any difficulties.

-Tim