Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions knowrob/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ function KnowrobClient(options){
that.connect();

that.episode = new KnowrobEpisode(that);
if(options.category && options.episode)
that.episode.setEpisode(options.category, options.episode);


that.createOverlay();

if(requireEpisode && !that.episode.hasEpisode()) {
Expand All @@ -113,6 +111,12 @@ function KnowrobClient(options){
});
};

function onRosConnected() {
that.registerNodes();
if(options.category && options.episode)
that.episode.setEpisode(options.category, options.episode);
}

this.connect = function () {
if(that.ros) return;
that.ros = new ROSLIB.Ros({url : rosURL});
Expand All @@ -121,11 +125,11 @@ function KnowrobClient(options){
console.log('Connected to websocket server.');
if (authentication) {
// Acquire auth token for current user and authenticate, then call registerNodes
that.authenticate(authURL, that.registerNodes);
that.authenticate(authURL, onRosConnected);
} else {
// No authentication requested, call registerNodes directly
that.registerNodes();
that.waitForJsonProlog();
onRosConnected();
}
});
that.ros.on('close', function() {
Expand Down