Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PointCloud2 and LaserScan #218

Merged
merged 5 commits into from
Apr 15, 2018
Merged

Conversation

mbredif
Copy link
Contributor

@mbredif mbredif commented Apr 4, 2018

This PR builds on #216 and #217 to address #213 and give extra functionnalities to PointCloud2 and LaserScan topics :

  • subsample : input PointCloud2 and LaserScan messages may be subsampled by the given amount (1 point every N other points). This is mostly useful to visualize topics with too many points per second.
  • material : the previous custom material implementation has been changed to a material option, which defaults to a THREE.PointsMaterial constructed from material if it is not a THREE.Material already. For instance, size, sizeAttenuation, color should now be specified as material.size, material.sizeAttenuation and material.color. See the doc of THREE.PointsMaterial and THREE.Material for available parameters.
  • colorsrc is expecting a PointCloud2 field name to be used for coloring (defaults to 'rgb')
  • colormap is expecting a function that converts the colorsrc field value to a THREE.Color (defaults to THREE.Color construction)
  • many aspects have been optimized (eg: skipped values are not decoded, dynamic buffers are used with tight update range counts...)

Misc:

  • I added a simple launchfile examples/ros3djs.launch to simplify setup to simply roslaunch examples/ros3djs.launch instead of launching manually roscore, rosbridge and tf2_web_republisher.
  • I also added a kitti.html example that is intended to be used to visualize rossified kitti datasets.

image

@mbredif
Copy link
Contributor Author

mbredif commented Apr 4, 2018

I added links in the kitti.html example so that people can get the dataset more easily.
I also added temporal subsampling : the subsample option is renamed pointRatio and the new option messageRatio is added to skip messages (in order to keep up with the incoming flow of points). The ratio corresponds to how much more points/messages were received compared to how much are displayed on screen.
The overall subsampling ratio is the product of the two.

Copy link

@FuzzAU FuzzAU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've posted a few suggested changes

var customUniforms =
{
texture: { type: 't', value: THREE.ImageUtils.loadTexture( texture ) },
texture: { type: 't', value: new THREE.TextureLoader().load( texture ) }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the ros3djs code uses spaces, so might be nice to remove the tab here

};

this.attribs =

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the extra spaces there are noise too. Some people get finicky about these things :-)

var customUniforms =
{
texture: { type: 't', value: THREE.ImageUtils.loadTexture( texture ) },
texture: { type: 't', value: new THREE.TextureLoader().load( texture ) }
//texture: { type: 't', value: THREE.ImageUtils.loadTexture( texture ) },
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you comment this code out, it might live there for ever
Git keeps the history, so just remove the line. People can refer to git if they want to know why and when it was remove

this.attribs =


/*this.attribs =
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here if commenting something out, just remove it

var customColor = [];
var alpha = [];

for(var i = 0; i < this.max_pts; i++){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this perhaps be done with something like
positions = new Array(3 * this.max_pts).fill(0);

Likely to be significantly more efficient with the browsers array fill.
It's reasonably well supported. I'm not sure how far back this project expects browser support, but it's been around for a while

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill

particles.attribs.customColor.needsUpdate = true;
particles.attribs.alpha.needsUpdate = true;
particles.points.needsUpdate = true;
//particles.attribs.customColor.needsUpdate = true;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this and the like 145 that is commented out

@FuzzAU
Copy link

FuzzAU commented Apr 6, 2018

oh I posted some suggestions, then realised you removed some of that code later anyway :-P oops

@mbredif
Copy link
Contributor Author

mbredif commented Apr 6, 2018

Sorry about that, i can squash the 2 commits if you prefer.
No comments on the 2nd commit ? :)

Copy link
Member

@jihoonl jihoonl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. It looks good. Could you address the comments in the code?
And could you remove package-lock.json?

* * texture - (optional) Image url for a texture to use for the points. Defaults to a single white pixel.
* * rootObject (optional) - the root object to add this marker to
* * size (optional) - size to draw each point (default 0.05)
* * max_pts (optional) - number of points to draw (default 100)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

color, size and texture are removed. Could you check if these fields are set and log deprecation warning with a guide to use the newer way?

* * texture - (optional) Image url for a texture to use for the points. Defaults to a single white pixel.
* * rootObject (optional) - the root object to add this marker to
* * size (optional) - size to draw each point (default 0.05)
* * max_pts (optional) - number of points to draw (default 100)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

texture and size are gone here also. Could you add a check with deprecation warning?

@jihoonl jihoonl mentioned this pull request Apr 8, 2018
@mbredif
Copy link
Contributor Author

mbredif commented Apr 9, 2018

Deprecation warning as been added here.
I also removed package-lock.json renamed Particles.js to Points.js to reflect the underlying changes.

mbredif and others added 2 commits April 10, 2018 11:10
Removing redundant roslaunch calls in the help.
@jihoonl jihoonl merged commit cdf9966 into RobotWebTools:develop Apr 15, 2018
keego added a commit to keego/ros3djs that referenced this pull request Apr 29, 2018
- This pulls in changes from PRs RobotWebTools#207, RobotWebTools#210, RobotWebTools#218, RobotWebTools#221, and RobotWebTools#223
- Note: src/sensors/Points.js was modified to *explicitly* extend THREE.Object3D to support transpiling
keego added a commit to keego/ros3djs that referenced this pull request Apr 29, 2018
- This pulls in changes from PRs RobotWebTools#207, RobotWebTools#210, RobotWebTools#218, RobotWebTools#221, and RobotWebTools#223
- Note: src/sensors/Points.js was modified to *explicitly* extend THREE.Object3D to support transpiling
keego added a commit to keego/ros3djs that referenced this pull request Apr 30, 2018
- This pulls in changes from PRs RobotWebTools#207, RobotWebTools#210, RobotWebTools#218, RobotWebTools#221, and RobotWebTools#223
- Note: src/sensors/Points.js was modified to *explicitly* extend THREE.Object3D to support transpiling
keego added a commit to keego/ros3djs that referenced this pull request Apr 30, 2018
- This pulls in changes from PRs RobotWebTools#207, RobotWebTools#210, RobotWebTools#218, RobotWebTools#221, and RobotWebTools#223
- Note: src/sensors/Points.js was modified to *explicitly* extend THREE.Object3D to support transpiling
keego added a commit to keego/ros3djs that referenced this pull request May 1, 2018
- This pulls in changes from PRs RobotWebTools#207, RobotWebTools#210, RobotWebTools#218, RobotWebTools#221, and RobotWebTools#223
- Note: src/sensors/Points.js was modified to *explicitly* extend THREE.Object3D to support transpiling
jihoonl pushed a commit that referenced this pull request Aug 24, 2018
* Fix links in example and readme (#206)

* Report error from ColladaLoader in MeshResource (#210)

this will hopefully make situations like #209 easier to debug

* Added Rollup

* Added yarn lockfile

* Removed references to COLLADA_LOADER_2

* Added es6 transpiler and rollup config, working on transpiling

* Touched up a couple potential mistypes prevent transpiler from working. 1 - removed explicit super.super() call from InteractiveMarker. 2 - Made Particles explicitly derive from THREE.Object3D.

* Rewrote Particles' method signatures in format consistent with rest of codebase

* Refactored updateMatrixWorld to be more statically analyzable

* ES6 modules properly compiling, Working on runtime errors

* Moved 'that' assignments happen *after* calls super constructors in derived classes

* Added missing super constructor call

* Removed assignment to read-only property causing a runtime error, added a relevant comment

* Moved all super constructor calls to preceed any use of 'this'

* Added shims for THREE and THREE extensions to support es6 compatible module extensions

* Cleanup and added examples for single page applications and using html imports in browsers

* Moved es6 support files to es6-support folder and renamed destination for es6 transpiled output

* Moved shims to top level

* Removed pre-es6 source code and es6 transpiler

* DepthCloud: make depth range adaptable + fix depth point position decoding (#207)

* PointCloud2 and LaserScan (#218)

* buffergeometry in PointCloud2
* pointcloud2: buffergeometry, subsampling
* renamed Particles.js to Points.js, deprecation warning in Points.js
* Update kitti.html
* Removing redundant roslaunch calls in the help.

* NavSatFix support (#221)

* fix: pointRatio option in PointCloud2 and LaserScan (#223)

* Added build products

* Removed extra log

* Added angular app example

* Added react app example and touched up other SPA examples

* Added build output

* Removed extra log

* Added angular app example

* Added react app example and touched up other SPA examples

* Updated ROSLIB import semantics

* Updated ROSLIB import semantics

* Switched ColladaLoader shim from official ColladaLoader to the ros3djs fork

* Switched ColladaLoader shim from official ColladaLoader to the ros3djs fork

* Updated html-import example to use yarn like the other examples

* Updated html-import example to use yarn like the other examples

* Updated outdated grunt plugins

* Fixed linter errors

* Updated grunt build process to build es6 output

* Switched from jshint to eslint, migrating rules and fixing lint issues

* Updated commonjs target to be es5

* Fixed pkg.module to use es6 module syntax, but es5 language features

* Fixed bug in Points class

* Switched from const to var for es5 compatibility

* Added PointCloud2 example for angular app

* Updated node version use by CI server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants