Skip to content
Snippets Groups Projects
Commit 38e7da5d authored by Manos Angelidis's avatar Manos Angelidis Committed by Ugo Albanese
Browse files

[NRRPLT-7962] Added error propagation mechanism from opensim to frontend

Merged in NRRPLT-7962 (pull request #41)

- New subscriber for the ~/error topic
- Functionality that checks whether the error is coming from opensim
  mesh handling and propagates the error to the frontend

Approved-by: Stefano Nardo
Approved-by: Sandro Weber
parent 7b87f446
No related branches found
No related tags found
No related merge requests found
...@@ -158,6 +158,25 @@ GZ3D.GZIface.prototype.onConnected = function() { ...@@ -158,6 +158,25 @@ GZ3D.GZIface.prototype.onConnected = function() {
}; };
this.statusTopic.subscribe(statusUpdate.bind(this)); this.statusTopic.subscribe(statusUpdate.bind(this));
this.errorTopic = new ROSLIB.Topic({
ros: this.webSocket,
name: '~/error',
messageType: 'error'
});
var errorUpdate = function (message) {
// error with id 1 means that opensim faied to load a mesh
if (message.id === 1) {
this.emitter.emit('opensimMeshError', message);
}
// generic gazebo error handling
else {
console.error(`Error received from gazebo: ${message}`);
}
};
this.errorTopic.subscribe(errorUpdate.bind(this));
this.materialTopic = new ROSLIB.Topic({ this.materialTopic = new ROSLIB.Topic({
ros: this.webSocket, ros: this.webSocket,
name: '~/material', name: '~/material',
......
...@@ -51,6 +51,11 @@ GZ3D.SdfParser.prototype.init = function() { ...@@ -51,6 +51,11 @@ GZ3D.SdfParser.prototype.init = function() {
that.onConnectionError(); that.onConnectionError();
} }
}); });
this.gziface.emitter.on('opensimMeshError', function (error) {
that.gui.guiEvents.emit('opensimMeshError', error, 5000);
that.onConnectionError();
});
}; };
/** /**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment