Skip to content

v2.0.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@jstnhuang jstnhuang released this 05 Sep 02:20
· 40 commits to master since this release

Version 2 of <ros-rviz> moves all configuration options into a single config property on ros-rviz:

var config = {
  globalOptions: { ... },
  displays = [ ... ],
  sidebarOpened: true
}
<ros-websocket auto url="{{ros}}" ros="{{ros}}"></ros-websocket>
<ros-rviz ros="[[ros]]" config="{{config}}" websocket-url="{{url}}"></ros-rviz>

Prior to this release, users changed the configuration by modifying the globalOptions, displays, and sidebarOpened properties individually.

To programmatically make changes, modify the config property using Polymer's object mutation methods. For example:

var rviz = document.getElementById("#rviz");
rviz.set('config.globalOptions.background', '#113344');

var grid = {
  isShown: true,
  name: 'Grid',
  options: {
    cellSize: 1,
    color: '#cccccc',
    numCells: 10
  },
  type: 'grid'
};
rviz.push('config.displays', grid);

The loadConfig method has been removed from <ros-rviz>. The config property can be modified directly as shown above, or reassigned to a new config object:

var config = { ... };
rviz.config = config;

A special configuration option is config.globalOptions.url. This is mirrored with the websocketUrl property, so that changes to one will update the other. This allows the websocketUrl property to be bound to the url property of <ros-websocket>, like so:

<ros-websocket auto url="{{ros}}" ros="{{ros}}"></ros-websocket>
<ros-rviz ros="[[ros]]" config="{{config}}" websocket-url="{{url}}"></ros-rviz>

This, in turn, allows the user to edit the websocket URL from the <ros-rviz> interface. Note that some displays will need to be deleted and re-added to work after a websocket URL change.

The fact that <ros-rviz> is on version 2 reflects the fact that there have been 2 breaking API changes and does not suggest that the software is production-ready. <ros-rviz> continues to be experimental and under development.