Skip to content

Latest commit

 

History

History
103 lines (62 loc) · 4.44 KB

README.md

File metadata and controls

103 lines (62 loc) · 4.44 KB

Documentation for lidar-webRTC(Peer-to-Peer Communication)

This is part of the LiDAR Data Streaming Project developed at TiHAN, IIT-H

This is an alternative to using Firebase; when both of the devices are not behind Symmetric NAT (AKA Full-Cone NAT). The type of NAT can be checked here. Permissive NAT is a requirement for Peer-to-Peer (WebRTC) communication.

To learn more about NAT, go here.

NOTE: A TURN Server is often cheaper than the Firebase method, however, it only allows single subscriber of the data stream. In contrast, the Firebase method allows multiple subscribers.

Environment Setup

ROS (preferably melodic version for Ubuntu 18.04) is required to be setup on both the sender (encoder) and the receiver (decoder).

ROS-Bridge Server Setup

ROS-Bridge server needs to be installed for roslibjs which was part of the project that this repository was intended for.

Installation: (Change melodic to the required version)

sudo apt-get install ros-melodic-rosbridge-server

Starting Server:

roslaunch rosbridge_server rosbridge_websocket.launch

Node Package Manager (NPM) and Node.js are required to be installed ([email protected]+, [email protected]+).

Obtaining Source Code and Building

The source code is available here.

Run the following commands:

cd ~ #directory where the project is to be located
git clone https://github.com/bhaskar-anand-iith/lidar-p2p
cd lidar-fb/ #root of project
npm i #installing dependencies

Troubleshooting Build Errors

npm -v
node -v

Execution

For testing locally:

npm run dev #runs the "dev" srcipt defined in package.json

Webpage Operation

The sender and the receiver each have a UUID (randomly generated uniquely identifying ID). For the peer-to-peer connection to be established, the sender must connect to the receiver using the receiver's UUID. Once the connection is established, the connection will be open until the webpage is reloaded or the sender connects to another receiver.

Sender/Sensor side: Once the webpage has loaded, the webpage automatically subscribes to /n2b_data rostopic, and immediately tries publishing to the peer. Data is only sent after connection is established with peer.

Receiver/Visualizer side: Once the webpage has loaded and the sender peer has established connection, the data starts being published to /b2n_data rostopic.

ROSTopic Specifications

Subscribes to /n2b_data topic (from native c++ code)

Publishes to /b2n_data topic (from browser)

Deployment

The app has been deployed on Heroku. It is connected with GitHub (through a webhook) and automatically deploys any changes that are made to the main branch (by default) in the connected GitHub repository.

Requires a Heroku account

Heroku Setup

  1. Go to Heroku Dashboard
  2. Click on New -> Create new app
  3. Enter App name, choose a region, and click Create app
  4. In the Deploy tab, set the deployment method to GitHub heroku deploy screen
  5. Search for the repository name (lidar-fb) (you must be owner of repository on GitHub. Explore GitHub Teams for more features)
  6. Enable Automatic Deploys and Deploy Branch (main)

The webapp will take some time to be built and deployed. The webapp can be accessed at App-name.herokuapp.com

For additional build information, access the Activity tab and click on the build of choice.

Troubleshooting Common Errors

  • Not connecting to peer/No messages being sent or received: check NAT type.
  • Receiving data but no visualization in RViz: check if roscore, ros-bridge server, and decoder are running.
  • No data is being sent: check if roscore, ros-bridge server, and encoder are running, check bandwidth.
  • Latency is continuously increasing over time: bandwidth is insufficient, find a better network.