kauffmanes / polymer-ros-rviz

A web component for ROS visualization.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

<ros-rviz>

Published on webcomponents.org

A Polymer element for ROS visualization. Versions 1+ are hybrid elements that support Polymer 1 and Polymer 2.

To run the demo, run rosbridge, tf2_web_republisher, and the interactive marker proxy as needed.

Quick start

  1. Install dependencies:

     curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash
     . ~/.bashrc
     nvm install node
     npm install -g bower polymer-cli
    
  2. Clone this repo:

     git clone https://github.com/osrf/polymer-ros-rviz
     cd polymer-ros-rviz
    
  3. Install:

     bower install
    
  4. Serve demos and docs:

     polymer serve --hostname 0.0.0.0
    

    The hostname is recommended if you're running from inside docker.

    By default, it will serve on port 8001

  5. View demo:

    http://localhost:8081/components/ros-rviz/demo/index-no-data-binding.html

    The no-data-binding demo is recommended since it works on Firefox, see issue #1

So far, there's nothing running in the backend, so the websocket has nothing to connect to.

Let's run an example:

  1. Install dependencies (assumes you already have core ROS Kinetic packages installed):

     sudo apt install -y \
       ros-kinetic-pr2-gazebo \
       ros-kinetic-rosbridge-server \
       ros-kinetic-tf2-web-republisher
    
  2. Install the Caddy web server, which will help us serve PR2 meshes with appropriate CORS settings:

     curl https://getcaddy.com | bash -s personal http.cors
    
  3. Copy the PR2 description in a place where it can be served from:

     mkdir ~/pr2_meshes -p
     cp -r /opt/ros/kinetic/share/pr2_description ~/pr2_meshes
    
  4. Create a Caddyfile in that directory with the following contents:

     cd ~/pr2_meshes
     vi Caddyfile
    

    Caddyfile:

     0.0.0.0:8001
     cors
    
  5. Start Caddy to serve the meshes on port 8081:

     caddy
    
  6. Start a Gazebo simulation of a PR2 robot, this will open a Gazebo window with a PR2 in an empty world.

     roslaunch pr2_gazebo pr2_empty_world.launch
    
  7. Start the ROSBridge websocket server, which defaults to port 9090:

     roslaunch rosbridge_server rosbridge_websocket.launch
    
  8. Start a TF2 republisher for the web:

     rosrun tf2_web_republisher tf2_web_republisher
    
  9. Now refresh the browser. This time no error should be printed to the console.

  10. Click on the + and add a "Robot model", the PR2 should show up in the scene.

    Note that the meshes may show up dark due to issue #3.

Tests

To run the tests, run the following:

roscore
roslaunch rosbridge_server rosbridge_websocket.launch
polymer test

Troubleshooting

If the robot doesn't show up by following the steps above, check that roslibjs and rosbridge are working properly. Try following roslibjs basic tutorial, and ensure that you can publish / subscribe to topics using Javascript. If subscriptions and parameters don't work, try reinstalling twisted Python package as recommended here, restart the bridge and check the communication once again. If it works, try displaying the robot again.

About

A web component for ROS visualization.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:JavaScript 52.8%Language:HTML 47.2%