ros3djs URDF not visible, but mesh loading works?
Hey guys,
Im trying to use ros3djs to setup a web interface and load my URDF. I've seen this problem around on the net but nobody seems to have a fix for it? My urdf just isn't loading however there is no visible errors. Below is how i am currently loading in the urdf:
this.rosBridgeServer = new ROSLIB.Ros({
url: 'ws://localhost:9090'
})
//Create 3D Ros viewer.
this.rosViewer3D = new ROS3D.Viewer({
divID : this.rosViewer3DContainer.id,
width : 800,
height : 600,
antialias : true,
intensity : 0.05,
background : '#303030'
});
// Add a grid.
this.rosViewer3D.addObject(new ROS3D.Grid());
// Setup a client to listen to TFs.
this.rosTFClient = new ROSLIB.TFClient({
ros : this.rosBridgeServer,
angularThres : 0.01,
transThres : 0.01,
rate : 10.0
});
// Setup the URDF client.
this.rosUrdfClient = new ROS3D.UrdfClient({
ros : this.rosBridgeServer,
tfClient : this.rosTFClient,
path : 'http://127.0.0.1:3000/',
rootObject : this.rosViewer3D.scene,
loader : ROS3D.COLLADA_LOADER,
param: 'robot_description'
});
I am using the following library versions (where ros3djs is the most recent version downloaded for local debugging):
<script src="https://static.robotwebtools.org/threejs/r89/three.min.js"></script>
<script src="https://static.robotwebtools.org/threejs/current/STLLoader.js"></script>
<script src="https://static.robotwebtools.org/EventEmitter2/0.4.14/eventemitter2.js"></script>
<script src="https://static.robotwebtools.org/ros3djs/0.18.0/ColladaLoader.js"></script>
<script src="https://static.robotwebtools.org/roslibjs/0.20.0/roslib.min.js"></script>
<script src="/js/ros3d.js"></script>
All my mesh files are in both .stl and .dae, i know the collada loader is working because i can load a mesh completely fine by using the ros3djs MeshResource
:
const mesh = new ROS3D.MeshResource({
resource: 'warthog_description/meshes/chassis.dae',
path: 'http://localhost:3000/',
warnings: true
});
this.rosViewer3D.add(mesh)
and in ros3d.js
in the Urdf
class if i make the following change to load the meshes instead of the SceneNode
all the meshes from the urdf file are loaded (but of course not correctly linked to their respective TF's as SceneNode does)
Line 54670 from ros3d.js:
// ignore mesh files which are not in Collada or STL format
if (fileType === '.dae' || fileType === '.stl') {
// create the model
var mesh = new MeshResource({
path : path,
resource : uri,
loader : loader,
material : colorMaterial
});
// check for a scale
if(link.visuals[i].geometry.scale) {
mesh.scale.copy(visual.geometry.scale);
}
// create a scene node with the model
var sceneNode = new SceneNode({
frameID : frameID,
pose : visual.origin,
tfClient : tfClient,
object : mesh
});
// this.add(sceneNode);
this.add(mesh); // ADDING THIS LINE LOADS ALL MESHES COMPLETELY FINE??????
} else {
console.warn('Could not load geometry mesh: '+uri);
}