mostly done with the wiring of new features

This commit is contained in:
Rohit
2019-06-25 20:06:10 -04:00
parent d0f9913e06
commit b9a80f38d0
2 changed files with 91 additions and 50 deletions

View File

@@ -318,7 +318,7 @@
<button id="recordingStartButton" type="button" onclick="triggerService('/left/aescape/hardware/calibrateRobotiq'); triggerService('/left/aescape/mode/activateTeachingController'); triggerService('/aescape/bags/startTeachRecording')" class="btn btn-primary col-md-4"> <button id="recordingStartButton" type="button" onclick="triggerService('/left/aescape/hardware/calibrateRobotiq'); triggerService('/left/aescape/mode/activateTeachingController'); triggerService('/aescape/bags/startTeachRecording')" class="btn btn-primary col-md-4">
Start Teach Recording Start Teach Recording
</button> </button>
<button id="recordingStopButton" type="button" onclick="triggerService('/aescape/bags/stopTeachRecording'); triggerService('/left/aescape/mode/activateReadyController')" class="btn btn-primary col-md-4"> <button id="recordingStopButton" type="button" onclick="triggerService('/aescape/bags/stopTeachRecording'); triggerService('/left/aescape/mode/activateReadyController'); displayTaggingOptions('teach')" class="btn btn-primary col-md-4">
Stop Teach Recording Stop Teach Recording
</button> </button>
</div> </div>
@@ -327,18 +327,18 @@
<div id="RecordingStatusLabel" class="message"> <div id="RecordingStatusLabel" class="message">
<!-- TO DO: Show errors in bag manager --> <!-- TO DO: Show errors in bag manager -->
</div> </div>
<div class="tagging-options open" id="teaching-tags"> <div class="tagging-options open" id="teachTags">
<div class="col-md-10"> <div class="col-md-10">
<!--full with naming box search:no new:yes--> <!--full with naming box search:no new:yes-->
<select id="playBagFileName" placeholder="Filename"></select> <select id="teachBagFileName" placeholder="Filename"></select>
<!--full width category box search:yes new:yes--> <!--full width category box search:yes new:yes-->
<select id="playBagCategory" placeholder="Category"></select> <select id="teachBagCategory" placeholder="Category"></select>
<!--full width tags box search:yes new:yes--> <!--full width tags box search:yes new:yes-->
<select id="playBagTags" placeholder="Tags"></select> <select id="teachBagTags" placeholder="Tags"></select>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<i class="fas fa-check-circle" onclick="hideTaggingOptions('teaching-tags', true)"></i> <i class="fas fa-check-circle" onclick="hideTaggingOptions('teachTags', true)"></i>
<i class="fas fa-times-circle" onclick="hideTaggingOptions('teaching-tags', false)"></i> <i class="fas fa-times-circle" onclick="hideTaggingOptions('teachTags', false)"></i>
</div> </div>
</div> </div>
<div id="playTagError" class="col-md-10"></div> <div id="playTagError" class="col-md-10"></div>
@@ -363,7 +363,7 @@
<button id="executionStartButton" type="button" onclick="triggerService('/left/aescape/mode/activateExecutionController'); triggerTopic('/left/run_trajectory')" class="btn btn-primary col-md-3"> <button id="executionStartButton" type="button" onclick="triggerService('/left/aescape/mode/activateExecutionController'); triggerTopic('/left/run_trajectory')" class="btn btn-primary col-md-3">
Play Loaded Recording Play Loaded Recording
</button> </button>
<button id="executionStopButton" type="button" onclick="triggerService('/aescape/bags/stopPlayingBag'); triggerService('/left/aescape/mode/activateReadyController')" class="btn btn-primary col-md-3"> <button id="executionStopButton" type="button" onclick="triggerService('/aescape/bags/stopPlayingBag'); triggerService('/left/aescape/mode/activateReadyController'); displayTaggingOptions('play')" class="btn btn-primary col-md-3">
Stop Playing Recording Stop Playing Recording
</button> </button>
</div> </div>
@@ -382,7 +382,7 @@
<!-- TO DO: Show errors in bag manager --> <!-- TO DO: Show errors in bag manager -->
</div> </div>
<!-- TO DO: Bagfile name must not start with "/" --> <!-- TO DO: Bagfile name must not start with "/" -->
<div class="tagging-options open" id="teaching-tags"> <div class="tagging-options open" id="playTags">
<div class="col-md-10"> <div class="col-md-10">
<!--full with naming box search:no new:yes--> <!--full with naming box search:no new:yes-->
<select id="playBagFileName" placeholder="Filename"></select> <select id="playBagFileName" placeholder="Filename"></select>
@@ -392,8 +392,8 @@
<select id="playBagTags" placeholder="Tags"></select> <select id="playBagTags" placeholder="Tags"></select>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<i class="fas fa-check-circle" onclick="hideTaggingOptions('teaching-tags', true)"></i> <i class="fas fa-check-circle" onclick="hideTaggingOptions('playTags', true)"></i>
<i class="fas fa-times-circle" onclick="hideTaggingOptions('teaching-tags', false)"></i> <i class="fas fa-times-circle" onclick="hideTaggingOptions('playTags', false)"></i>
</div> </div>
</div> </div>
<div> <div>

View File

@@ -16,6 +16,38 @@ function getBagList(callback)
}); });
} }
function getBagCategoryList(callback)
{
var service = new ROSLIB.Service({
ros : ros,
name : '/aescape/bags/getCategoryList',
serviceType : 'demobot/TriggerList'
});
var request = new ROSLIB.ServiceRequest({});
service.callService(request, function(result) {
callback(result.message);
});
}
function getBagTagList(callback)
{
var service = new ROSLIB.Service({
ros : ros,
name : '/aescape/bags/getTagList',
serviceType : 'demobot/TriggerList'
});
var request = new ROSLIB.ServiceRequest({});
service.callService(request, function(result) {
callback(result.message);
});
}
setTimeout(function(){ setTimeout(function(){
var $select = $('#bagList').selectize({ var $select = $('#bagList').selectize({
@@ -50,9 +82,25 @@ setTimeout(function(){
$(function () { $(function () {
$('[data-toggle="popover"]').popover() $('[data-toggle="popover"]').popover()
}) })
}, 100);
var $select = $('#playBagFileName').selectize({
function displayTaggingOptions(mode) {
var modeTag = '#' + mode + 'Tag';
var fileNameSelector = '#' + mode + 'BagFileName';
var categorySelector = '#' + mode + 'BagCategory';
var tagSelector = '#' + mode + 'BagTags';
//Subscribe to topics from the backend which indicate recording or playback is complete
document.querySelector(modeTag).classList.add('open');
//Putting this in a timeout to wait for the animation to finish completing
setTimeout(function(){
document.querySelector(modeTag).setAttribute('overflow', 'visible');
}, 600)
var $fileNameSelect = $(fileNameSelector).selectize({
valueField: 'name', valueField: 'name',
labelField: 'name', labelField: 'name',
searchField: ['name'], searchField: ['name'],
@@ -61,13 +109,16 @@ setTimeout(function(){
placeholder : "Enter a name for the bag" placeholder : "Enter a name for the bag"
}); });
var selectize = $select[0].selectize; var fileNameSelectize = $fileNameSelect[0].selectize;
selectize.clearOptions() fileNameSelectize.clearOptions()
selectize.addOption([].map(function(bagName){ // /aescape/bags/getBagList
return {name : bagName} getBagList(function(result){
})); fileNameSelectize.addOption([].map(function(bagName){
return {name : bagName}
}));
})
var $select2 = $('#playBagCategory').selectize({ var $categoryNameSelect = $(categorySelector).selectize({
valueField: 'name', valueField: 'name',
labelField: 'name', labelField: 'name',
searchField: ['name'], searchField: ['name'],
@@ -76,14 +127,15 @@ setTimeout(function(){
placeholder : "Enter or select a category for the bag" placeholder : "Enter or select a category for the bag"
}); });
var selectize2 = $select2[0].selectize; var categoryNameSelectize = $categoryNameSelect[0].selectize;
//selectize.clearOptions() categoryNameSelectize.clearOptions()
results2 = ['Production', 'Test']; getBagCategoryList(function(result){
selectize2.addOption(results2.map(function(bagName){ categoryNameSelectize.addOption(['Production', 'Test'].map(function(bagName){
return {name : bagName} return {name : bagName}
})); }));
})
var $select3 = $('#playBagTags').selectize({ var $tagSelect = $(tagSelector).selectize({
valueField: 'name', valueField: 'name',
labelField: 'name', labelField: 'name',
searchField: ['name'], searchField: ['name'],
@@ -93,31 +145,14 @@ setTimeout(function(){
placeholder : "Enter or select tags for the bag" placeholder : "Enter or select tags for the bag"
}); });
var selectize3 = $select3[0].selectize; var tagSelectize = $tagSelect[0].selectize;
//selectize.clearOptions() tagSelectize.clearOptions()
results3 = ['single-arm', 'dual-arm', 'palpation', 'demo']; getBagTagList(function(results){
selectize3.addOption(results3.map(function(bagName){ tagSelectize.addOption(['single-arm', 'dual-arm', 'palpation', 'demo'].map(function(bagName){
return {name : bagName} return {name : bagName}
})); }));
})
}, 100);
function displayTaggingOptions(id) {
//populate the values in the select boxes on every display
// /aescape/bags/getCategoryList
// /aescape/bags/getTagList
// /aescape/bags/getBagList
//Subscribe to topics from the backend which indicate recording or playback is complete
document.getElementById(id).classList.add('open');
//Putting this in a timeout to wait for the animation to finish completing
setTimeout(function(){
document.getElementById(id).setAttribute('overflow', 'visible');
}, 600)
} }
function hideTaggingOptions(id, updateValues=false) { function hideTaggingOptions(id, updateValues=false) {
@@ -137,7 +172,13 @@ function updateBagMetadata(mode, bag_name, modified_bag_name, category, tags) {
if(!bag_name) { if(!bag_name) {
return // error return // error
} }
triggerService('/aescape/bags/updateBagMeta') triggerService('/aescape/bags/updateBagMeta', {
mode : mode,
bag_name : bag_name,
modified_bag_name : modified_bag_name,
category : category,
tags : tags
})
} }