A Polymer element for ROS visualization. Versions 1+ are hybrid elements that support Polymer 1 and Polymer 2.
- API Documentation
- User guide
- Demo. Note that the demo requires a secure websocket server, since it is served over HTTPS.
To run the demo, run rosbridge
, tf2_web_republisher
, and the interactive marker proxy as needed.
-
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
-
Clone this repo:
git clone https://github.com/osrf/polymer-ros-rviz cd polymer-ros-rviz
-
Install:
bower install
-
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
-
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:
-
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
-
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
-
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
-
Create a
Caddyfile
in that directory with the following contents:cd ~/pr2_meshes vi Caddyfile
Caddyfile:
0.0.0.0:8001 cors
-
Start Caddy to serve the meshes on port 8081:
caddy
-
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
-
Start the ROSBridge websocket server, which defaults to port 9090:
roslaunch rosbridge_server rosbridge_websocket.launch
-
Start a TF2 republisher for the web:
rosrun tf2_web_republisher tf2_web_republisher
-
Now refresh the browser. This time no error should be printed to the console.
-
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.
To run the tests, run the following:
roscore
roslaunch rosbridge_server rosbridge_websocket.launch
polymer test
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.