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

Transparency for PointCloud2 configured in a custom colormap is not working #527

Open
raphaelVig opened this issue Apr 29, 2022 · 0 comments
Labels

Comments

@raphaelVig
Copy link

Description

  • Library Version: 1.0.1
  • ROS Version: Melodic
  • Platform / OS: Windows 10

Steps To Reproduce

here is some code used greatly inspired by the ones that can be found on classical tutorial.

          //création du viewer de l urdf

	const viewer = new ROS3D.Viewer({
		divID: id_div,
		width: this.state.largeur,
		height: this.state.hauteur,
		antialias: true
	});

	this.viewer = viewer;

	//ajout de la grille, il est possible de changer la couleur, la taille des cellules etc.
	viewer.addObject(new ROS3D.Grid());

	//initialisation du TF
	var tfClient = new ROSLIB.TFClient({
		ros: this.ros,
		angularThres: 0.01,
		transThres: 0.01,
		rate: 1,
		fixedFrame: 'base_link', // frame qui va servir de référence pour l'image
	});
	
	// objet permettant de lire sur un topic ROS de type PointCloud2 
	// pour l'afficher sur le panel du robot 3D 

	let newPointCloud = new ROS3D.PointCloud2({
		ros: this.ros,
		tfClient: this.tfClient,
		// il eciste plusieurs topic de type PointCloud2

		topic: /rtabmap/cloud_map,
		max_pts: 500000, 
		rootObject: viewer.scene,
		material: {size: 0.06}, 
		colormap: this.colormap,
	});

	// Ne pas oublier dec changer l'URL pour exporter une version de production

	new ROS3D.UrdfClient({
			ros: this.ros,
			tfClient: this.tfClient,
			path: URL_DEV, // url to ros
			rootObject: viewer.scene,
			loader : new ColladaLoader() // cela permet d'analyser les meshes pour les afficher
	});

here is the colormap function :

           colormap = (x) => {
	let rgb;

	// line 54279 de ROS3d nous renvoie une valeur qui n'est pas un nombre parfois et qui explique le manque de couleur
	if(isNaN(x)) {
		rgb = {
			r: 1,
			g: 1,
			b: 1,
			a: 0,
		};
	} else {
		this._floatColor[0] = x;
		const intColor = new Int32Array(this._floatColor.buffer);
		const colorInt = intColor[0];
		rgb = {
			r: this._rgb_lut[(colorInt >> 16) & 0xff],
			g: this._rgb_lut[(colorInt >> 8) & 0xff],
			b: this._rgb_lut[(colorInt) & 0xff],
			a: 1.0
		};
	}
	return rgb;
}

Expected Behavior

non numeric Value sent by ros3d.Point.getColor should then be transparent.

Actual Behavior

non numeric Value sent by ros3d.Point.getColor should are filled with a color that have are fully white.

pointcloud2_interface_bis

@raphaelVig raphaelVig added the bug label Apr 29, 2022
k-aguete pushed a commit to k-aguete/ros3djs that referenced this issue Oct 21, 2022
Bumps [@xmldom/xmldom](https://github.com/xmldom/xmldom) from 0.8.0 to 0.8.1.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](xmldom/xmldom@0.8.0...0.8.1)

---
updated-dependencies:
- dependency-name: "@xmldom/xmldom"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant