From fb126619bb3bb8a6da5c45f612205ec4e01c92df Mon Sep 17 00:00:00 2001 From: Rohith Karthikeyan Date: Mon, 1 Jul 2019 22:19:23 -0400 Subject: [PATCH] fixes --- .../components/coordinator/js/ros_scripts.js | 47 +++++++++++---- .../components/coordinator/js/update_guis.js | 8 ++- client/app/utilities/ros_scripts.js | 60 ------------------- 3 files changed, 42 insertions(+), 73 deletions(-) diff --git a/client/app/components/coordinator/js/ros_scripts.js b/client/app/components/coordinator/js/ros_scripts.js index 71abeb0..791b8ae 100644 --- a/client/app/components/coordinator/js/ros_scripts.js +++ b/client/app/components/coordinator/js/ros_scripts.js @@ -71,15 +71,13 @@ class ArmControls this.frankaForceCommandedTopic = new ROSLIB.Topic({ ros : ros, - name : '/'+this.namespace+'/robot_goal', + name : '/'+this.namespace+'/goal_wrench', messageType : 'geometry_msgs/WrenchStamped', throttle_rate : 500 // 2Hz }); this.frankaForceCommandedTopic.subscribe(this.frankaForce.bind(this, 'commanded')); - - this.lastActiveButton = { safetyMode : null, frankaMode : null, @@ -347,6 +345,26 @@ executingBagTopic.subscribe(function(message) { }); + +var bagNotifier = new ROSLIB.Topic({ + ros : ros, + name : '/left/playback/status', + messageType : 'std_msgs/String' +}); + + +bagNotifier.subscribe(function(message) { + console.log("bagNotifier: " +message.data) + if (message.data === "playing") { + + } else if (message.data === "stopped") + { + + } + +}); + + // Last Bag var bagPlayingTopic = new ROSLIB.Topic({ ros : ros, @@ -364,6 +382,8 @@ bagPlayingTopic.subscribe(function(message) { function triggerService(serviceName, toSend, callback) { + disableUI(); + var callback = callback || $.noop; if(!toSend) { @@ -423,8 +443,7 @@ function triggerService(serviceName, toSend, callback) { delay: 1000 }); }); - console.log("callback from callService in triggerService"); - console.log(callback); + enableUI(); return callback(null, {success : true}); } else { $(document).ready(function(){ @@ -439,6 +458,7 @@ function triggerService(serviceName, toSend, callback) { delay: 1000 }); }); + enableUI(); return callback("Something went wrong :( " + serviceName, {success : false}); } }, function(error){ @@ -455,6 +475,7 @@ function triggerService(serviceName, toSend, callback) { delay: 1000 }); }); + enableUI(); return callback("Something went wrong :( " + serviceName, {success : false}) }); var responseCheckInterval = setInterval(function() { @@ -476,6 +497,7 @@ function triggerService(serviceName, toSend, callback) { }); }); clearInterval(responseCheckInterval); + enableUI(); return; } }, 1000); @@ -512,8 +534,8 @@ function setEEFConfig(arm, config) { function startTeachRecoding() { async.waterfall([ function(callback) { - triggerService('/left/aescape/hardware/calibrateRobotiq', false, function(){ - callback(); + triggerService('/left/aescape/hardware/calibrateRobotiq', false, function(err, res){ + callback(err, res); }); }, function(response, callback) { @@ -523,25 +545,23 @@ function startTeachRecoding() { triggerService('/aescape/bags/startTeachRecording', false, callback) } ], function (err, result) { - + console.log("starting teach recoding"); }); } function stopTeachRecording() { async.waterfall([ function(callback) { - console.log("function 1"); triggerService('/aescape/bags/stopTeachRecording', false, callback); }, function(response, callback) { - console.log("function 2"); triggerService('/left/aescape/mode/activateReadyController', false, callback); }, function(response, callback) { - console.log("function 3"); - console.log(callback) + setTimeout(function(){ displayTaggingOptions('teach'); callback(); + }, 2000) } ], function (err, result) { console.log(err); @@ -571,8 +591,11 @@ function stopPlayingRecording() { triggerService('/left/aescape/mode/activateReadyController', false, callback); }, function(response, callback) { + setTimeout(function(){ displayTaggingOptions('play'); callback(); + }, 2000) + } ], function (err, result) { // result now equals 'done' diff --git a/client/app/components/coordinator/js/update_guis.js b/client/app/components/coordinator/js/update_guis.js index bac1b3c..a4a423a 100644 --- a/client/app/components/coordinator/js/update_guis.js +++ b/client/app/components/coordinator/js/update_guis.js @@ -9,9 +9,15 @@ function getBagList(callback) serviceType : 'demobot/TriggerList' }); - var request = new ROSLIB.ServiceRequest({}); + toSend = { + message : String(Math.random()) + } + + var request = new ROSLIB.ServiceRequest(toSend); service.callService(request, function(result) { + console.log("result from getBagList"); + console.log(result.message); callback(JSON.parse(result.message)); }); } diff --git a/client/app/utilities/ros_scripts.js b/client/app/utilities/ros_scripts.js index b050986..849e651 100644 --- a/client/app/utilities/ros_scripts.js +++ b/client/app/utilities/ros_scripts.js @@ -183,66 +183,6 @@ ros.on('close', function() { //ros.connect(ros.connectionName); -/////////////////////////////////////////////////////////////////////////////////// -// Publishers -/////////////////////////////////////////////////////////////////////////////////// - -function publishBagMessage(bagFilename) -{ - var bag_file_message = "" - bag_file_message += bagFilename; - if (bagFilename != "STOP") - { - for (topic in ros.topics) - { - if(ros.topics[topic].bag) - { - bag_file_message += " " + ros.topics[topic].name - } - } - } - var bagMessage = new ROSLIB.Message({ - data : bagFilename - }) - bagPublisher.publish(bagMessage) -} - -//////////////////////////////////////////////////////////////// -// Topics -//////////////////////////////////////////////////////////////// - -var bagPublisher = new ROSLIB.Topic({ - ros : ros, - name : 'bag_publisher', - messageType : 'std_msgs/String' -}); - -var bagNotifier = new ROSLIB.Topic({ - ros : ros, - name : 'bag_notifier', - messageType : 'std_msgs/String' -}); - -//////////////////////////////////////////////////////////////// -// Subscribers -//////////////////////////////////////////////////////////////// - - -bagNotifier.subscribe(function(message) { - if (message.data === "STARTED") { - document.getElementById("recordButtonText").innerHTML = "Stop" - document.getElementById("recordButton").className = "btn btn-danger" - } else if (message.data === "STOPPED") - { - document.getElementById("recordButtonText").innerHTML = "Start" - document.getElementById("recordButton").className = "btn btn-primary" - } - - console.log("bagNotifier: " +message.data) -}); - - - /////////////////////////////////////////////////////////////////////////////////// // Functions ///////////////////////////////////////////////////////////////////////////////////