getColor from ros3djs is sending non numeric value
I am trying to display a PointCloud2 into a web interface.
To do that I am using the javascript librairy ros3djs and its object PointCloud2.
I am able to visualize the different point on my interface. However when I want to display the color of this PointCloud2 by using a custom colormap, ros3djs is sending me non numeric value for a lot of point.
Perhaps it is my PointCloud2 msg that is sending non correct value but on RVIZ the point cloud displayed is correct.
The code that I use for the colormap :
colormap = (x) => {
//console.log(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: 1.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;
}
Do you know what could be the source of those non numeric value for colors ?