Skip to content

Commit

Permalink
Merge branch 'develop' into support-custom-resolutions-properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Kunovski authored Jan 28, 2019
2 parents f633c8d + 80f6fde commit a6bdfdf
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 17 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
## Change Log

### 1.0.0 (2019/01/16 14:48 +00:00)
- [#245](https://github.com/RobotWebTools/ros3djs/pull/245) Update and normalize EventEmitter2 dependency (@mvollrath)
- [#244](https://github.com/RobotWebTools/ros3djs/pull/244) Fix PointCloud2 buffers (@mvollrath)
- [#239](https://github.com/RobotWebTools/ros3djs/pull/239) Use CBOR compression for PointCloud2 (@mvollrath)
- [#238](https://github.com/RobotWebTools/ros3djs/pull/238) Add quaternion copy method call to avoid read-only exception (@epaezrubio)
- [#235](https://github.com/RobotWebTools/ros3djs/pull/235) Use DataTexture for OccupancyGrid (@mvollrath)
- [#232](https://github.com/RobotWebTools/ros3djs/pull/232) add initial support for 3d markers with plane movement (@duwke)
- [#229](https://github.com/RobotWebTools/ros3djs/pull/229) Adding an ES6 only branch (@keego)
- [#223](https://github.com/RobotWebTools/ros3djs/pull/223) fix: pointRatio option in PointCloud2 and LaserScan (@mbredif)
- [#221](https://github.com/RobotWebTools/ros3djs/pull/221) NavSatFix support (@mbredif)
- [#219](https://github.com/RobotWebTools/ros3djs/pull/219) NavSatFix support (@mbredif)
- [#218](https://github.com/RobotWebTools/ros3djs/pull/218) PointCloud2 and LaserScan (@mbredif)
- [#214](https://github.com/RobotWebTools/ros3djs/pull/214) Add ES6 module support (@keego)
- [#210](https://github.com/RobotWebTools/ros3djs/pull/210) add error reporting to MeshResource (@T045T)
- [#206](https://github.com/RobotWebTools/ros3djs/pull/206) Fix links in example and readme (@jihoonl)

### 0.18.0 (2018/01/04 16:00 +00:00)
- [#203](https://github.com/RobotWebTools/ros3djs/pull/203) fix highlighting with Three.js r88 (@T045T)
- [#202](https://github.com/RobotWebTools/ros3djs/pull/202) Update coadebase to use Three.js version r88 (@jihoonl)
Expand Down
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ros3d",
"homepage": "https://www.robotwebtools.org",
"description": "(BOWER IS DEPRECATING! Please use npm version of ros3d). The standard ROS Javascript Visualization Library",
"version": "0.18.0",
"version": "1.0.0",
"license": "BSD-3-Clause",
"main": "./src/Ros3D.js",
"repository": {
Expand All @@ -21,8 +21,8 @@
"Robot Webtools Team <robot-web-tools@googlegroups.com> (http://robotwebtools.org)"
],
"dependencies": {
"eventemitter2": "asyncly/EventEmitter2#^0.4.14",
"eventemitter2": "^4.1.0",
"threejs": "mrdoob/three.js#r88",
"roslibjs": "RobotWebTools/roslibjs#0.14.0"
"roslibjs": "RobotWebTools/roslibjs#1.0.0"
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"name": "ros3d",
"homepage": "https://www.robotwebtools.org",
"description": "The standard ROS Javascript Visualization Library",
"version": "0.18.0",
"version": "1.0.0",
"license": "BSD-3-Clause",
"main": "./build/ros3d.cjs.js",
"module": "./build/ros3d.esm.js",
"dependencies": {
"eventemitter2": "~2.2.0",
"roslib": ">=0.14.0",
"eventemitter2": "^4.1.0",
"roslib": "^1.0.0",
"three": "^0.88.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/Ros3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

var ROS3D = ROS3D || {
REVISION : '0.18.0'
REVISION : '1.0.0'
};

// Marker types
Expand Down
19 changes: 14 additions & 5 deletions src/sensors/PointCloud2.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ for(var i=0;i<64;i++){decode64.e[decode64.S.charAt(i)]=i;}
* * ros - the ROSLIB.Ros connection handle
* * topic - the marker topic to listen to (default: '/points')
* * tfClient - the TF client handle to use
* * compression (optional) - message compression (default: 'cbor')
* * rootObject (optional) - the root object to add this marker to use for the points.
* * max_pts (optional) - number of points to draw (default: 10000)
* * pointRatio (optional) - point subsampling ratio (default: 1, no subsampling)
Expand All @@ -60,8 +61,11 @@ ROS3D.PointCloud2 = function(options) {
options = options || {};
this.ros = options.ros;
this.topicName = options.topic || '/points';
this.compression = options.compression || 'cbor';
this.max_pts = options.max_pts || 10000;
this.points = new ROS3D.Points(options);
this.rosTopic = undefined;
this.buffer = null;
this.subscribe();
};
ROS3D.PointCloud2.prototype.__proto__ = THREE.Object3D.prototype;
Expand All @@ -80,7 +84,8 @@ ROS3D.PointCloud2.prototype.subscribe = function(){
this.rosTopic = new ROSLIB.Topic({
ros : this.ros,
name : this.topicName,
messageType : 'sensor_msgs/PointCloud2'
messageType : 'sensor_msgs/PointCloud2',
compression: this.compression
});
this.rosTopic.subscribe(this.processMessage.bind(this));
};
Expand All @@ -91,16 +96,20 @@ ROS3D.PointCloud2.prototype.processMessage = function(msg){
}

var n, pointRatio = this.points.pointRatio;
var bufSz = this.max_pts * msg.point_step;

if (msg.data.buffer) {
this.points.buffer = msg.data.buffer;
n = msg.height*msg.width / pointRatio;
this.buffer = msg.data.slice(0, Math.min(msg.data.byteLength, bufSz));
n = Math.min(msg.height*msg.width / pointRatio, this.points.positions.array.length / 3);
} else {
n = decode64(msg.data, this.points.buffer, msg.point_step, pointRatio);
if (!this.buffer || this.buffer.byteLength < bufSz) {
this.buffer = new Uint8Array(bufSz);
}
n = decode64(msg.data, this.buffer, msg.point_step, pointRatio);
pointRatio = 1;
}

var dv = new DataView(this.points.buffer.buffer);
var dv = new DataView(this.buffer.buffer);
var littleEndian = !msg.is_bigendian;
var x = this.points.fields.x.offset;
var y = this.points.fields.y.offset;
Expand Down
5 changes: 0 additions & 5 deletions src/sensors/Points.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,13 @@ ROS3D.Points = function(options) {
}

this.sn = null;
this.buffer = null;
};

ROS3D.Points.prototype.__proto__ = THREE.Object3D.prototype;

ROS3D.Points.prototype.setup = function(frame, point_step, fields)
{
if(this.sn===null){
// scratch space to decode base64 buffers
if(point_step) {
this.buffer = new Uint8Array( this.max_pts * point_step );
}
// turn fields to a map
fields = fields || [];
this.fields = {};
Expand Down

0 comments on commit a6bdfdf

Please sign in to comment.