Play Mode Operations
diff --git a/client/app/components/coordinator/js/ros_scripts.js b/client/app/components/coordinator/js/ros_scripts.js
index 837420f..3f504c7 100644
--- a/client/app/components/coordinator/js/ros_scripts.js
+++ b/client/app/components/coordinator/js/ros_scripts.js
@@ -62,8 +62,8 @@ class ArmControls
this.frankaForceObservedTopic = new ROSLIB.Topic({
ros : ros,
- name : '/'+this.namespace+'/monitor/robot_goal',
- messageType : 'aescape_control/RobotGoal',
+ name : '/'+this.namespace+'/franka_state_controller/F_ext_base',
+ messageType : 'geometry_msgs/WrenchStamped',
throttle_rate : 500 // 2Hz
});
@@ -208,17 +208,19 @@ class ArmControls
}
if (forceTypeCode == 'observed') {
var forceType = "Observed";
+ console.log(message)
}
if (forceTypeCode == 'commanded') {
var forceType = "Commanded";
}
- if(this.namespace == 'right' && forceTypeCode == 'commanded') {
- console.log("frankaForce");
- console.log(message)
- }
+ // if(this.namespace == 'right' && forceTypeCode == 'commanded') {
+ // console.log("frankaForce");
+ // console.log(message)
+ // }
var force = message.wrench.force
+
document.getElementById("frankaForce" + bindedArm + forceType + "X").innerHTML = force.x.toFixed(1)
document.getElementById("frankaForce" + bindedArm + forceType + "Y").innerHTML = force.y.toFixed(1)
document.getElementById("frankaForce" + bindedArm + forceType + "Z").innerHTML = force.z.toFixed(1)
@@ -361,6 +363,8 @@ executingBagTopic.subscribe(function(message) {
// Playback status
+var lastPlaybackStatus;
+var lastStatusBag;
var playbackStatus = new ROSLIB.Topic({
ros : ros,
name : '/left/playback/status',
@@ -368,19 +372,25 @@ var playbackStatus = new ROSLIB.Topic({
});
playbackStatus.subscribe(function(message) {
- console.log("playbackStatus");
- console.log(message);
message = JSON.parse(message.data);
status = message.status;
bagName = message.bag_file;
+ console.log("status");
+ console.log(status);
+ if (status != lastPlaybackStatus) {
+
+ if (status === "playing") {
- if (status === "playing") {
-
- } else if (message === "stopped")
- {
- triggerService('/left/aescape/mode/activateReadyController');
- triggerService('/right/aescape/mode/activateReadyController');
- displayTaggingOptions('play');
+ } else if (status === "stopped") {
+ triggerService('/left/aescape/mode/activateReadyController');
+ triggerService('/right/aescape/mode/activateReadyController');
+ displayTaggingOptions('play');
+ } else if (status === "loaded" && lastPlaybackStatus !== "playing") {
+ console.log("lastPlaybackStatus");
+ console.log(lastPlaybackStatus);
+ displayMessage(true, "Loaded the selected bag file!")
+ }
+ lastPlaybackStatus = status;
}
});
@@ -442,9 +452,6 @@ function triggerService(serviceName, toSend, callback) {
var request = new ROSLIB.ServiceRequest({message : toSend});
}
- var hellobiatch = "hellobiatch"
-
-
/*
var service = new ROSLIB.Service({
ros : ros,
@@ -520,7 +527,7 @@ function triggerService(serviceName, toSend, callback) {
if(serviceCallReturned) {
clearInterval(responseCheckInterval);
return;
- } else if (timeElapsedSinceServiceCall > 7000){
+ } else if (timeElapsedSinceServiceCall > 3000){
$(document).ready(function(){
$.notify({
message: "Timeout on " + serviceName
@@ -609,6 +616,16 @@ function playLoadedRecording() {
function(callback) {
triggerService('/left/aescape/mode/activateExecutionController', false, callback);
},
+ function(response, callback) {
+ var singleArmMode = $('#armMode').val();
+ if (singleArmMode == "1") {
+ singleArmMode = true;
+ callback(null, null);
+ } else {
+ singleArmMode = false;
+ triggerService('/right/aescape/mode/activateExecutionController', false, callback);
+ }
+ },
function(response, callback) {
triggerTopic('/left/run_trajectory', false, callback)
}
@@ -622,9 +639,12 @@ function stopPlayingRecording() {
function(callback) {
triggerService('/aescape/bags/stopPlayingBag', false, callback);
},
- // function(response, callback) {
- // triggerService('/left/aescape/mode/activateReadyController', false, callback);
- // },
+ function(response, callback) {
+ triggerService('/left/aescape/mode/activateReadyController', false, callback);
+ },
+ function(response, callback) {
+ triggerService('/right/aescape/mode/activateReadyController', false, callback);
+ },
function(response, callback) {
//displayTaggingOptions('play');
callback();
diff --git a/client/app/components/coordinator/js/update_guis.js b/client/app/components/coordinator/js/update_guis.js
index a4a423a..f471fc7 100644
--- a/client/app/components/coordinator/js/update_guis.js
+++ b/client/app/components/coordinator/js/update_guis.js
@@ -16,8 +16,6 @@ function getBagList(callback)
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));
});
}
@@ -296,18 +294,12 @@ function hideLoadingOptions(loadBag) {
console.log(singleArmMode)
if(loadBag) {
var selectedBagName = $('#loadBagList').val();
- var singleArmMode = $('#armMode').val();
- if (singleArmMode) {
- singleArmMode = true
- } else {
- singleArmMode = false
- }
loadSelectedBagFile(selectedBagName, singleArmMode, function(updateError){
- if(updateError) {
- displayMessage(false, "Something went wrong in the backend while fetching the bag files :(")
- } else {
- displayMessage(true, "Loaded the selected bag file!")
- }
+ // if(updateError) {
+ // displayMessage(false, "Something went wrong in the backend while fetching the bag files :(")
+ // } else {
+ // displayMessage(true, "Loaded the selected bag file!")
+ // }
})
}
var selector = '#loadBags';
@@ -315,20 +307,38 @@ function hideLoadingOptions(loadBag) {
document.querySelector(selector).classList.remove('open');
}
+
+
+
function loadSelectedBagFile(selectedBagName, singleArmMode, callback) {
var toSend = {
bag_name : selectedBagName,
single_arm : singleArmMode
}
- triggerService('/aescape/bags/startPlayingRecording', toSend, function(error, result) {
- if(!result) {
- return callback("Something went wrong in the backend while updating.");
- }
- else {
- return callback();
- }
- })
+ // triggerService('/aescape/bags/startPlayingRecording', toSend, function(error, result) {
+ // if(!result) {
+ // return callback("Something went wrong in the backend while updating.");
+ // }
+ // else {
+ // return callback();
+ // }
+ // })
+
+ var toSendString = JSON.stringify(toSend);
+
+ console.log("toSend string")
+ console.log(toSendString)
+
+ var topic = new ROSLIB.Topic({
+ ros : ros,
+ name : "/left/playback/control",
+ messageType : 'std_msgs/String'
+ });
+
+ var msg = new ROSLIB.Message({data:toSendString});
+
+ topic.publish(msg);
}