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">
Start Teach Recording
</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
</button>
</div>
@@ -327,18 +327,18 @@
<div id="RecordingStatusLabel" class="message">
<!-- TO DO: Show errors in bag manager -->
</div>
<div class="tagging-options open" id="teaching-tags">
<div class="tagging-options open" id="teachTags">
<div class="col-md-10">
<!--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-->
<select id="playBagCategory" placeholder="Category"></select>
<select id="teachBagCategory" placeholder="Category"></select>
<!--full width tags box search:yes new:yes-->
<select id="playBagTags" placeholder="Tags"></select>
<select id="teachBagTags" placeholder="Tags"></select>
</div>
<div class="col-md-2">
<i class="fas fa-check-circle" onclick="hideTaggingOptions('teaching-tags', true)"></i>
<i class="fas fa-times-circle" onclick="hideTaggingOptions('teaching-tags', false)"></i>
<i class="fas fa-check-circle" onclick="hideTaggingOptions('teachTags', true)"></i>
<i class="fas fa-times-circle" onclick="hideTaggingOptions('teachTags', false)"></i>
</div>
</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">
Play Loaded Recording
</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
</button>
</div>
@@ -382,7 +382,7 @@
<!-- TO DO: Show errors in bag manager -->
</div>
<!-- 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">
<!--full with naming box search:no new:yes-->
<select id="playBagFileName" placeholder="Filename"></select>
@@ -392,8 +392,8 @@
<select id="playBagTags" placeholder="Tags"></select>
</div>
<div class="col-md-2">
<i class="fas fa-check-circle" onclick="hideTaggingOptions('teaching-tags', true)"></i>
<i class="fas fa-times-circle" onclick="hideTaggingOptions('teaching-tags', false)"></i>
<i class="fas fa-check-circle" onclick="hideTaggingOptions('playTags', true)"></i>
<i class="fas fa-times-circle" onclick="hideTaggingOptions('playTags', false)"></i>
</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(){
var $select = $('#bagList').selectize({
@@ -50,9 +82,25 @@ setTimeout(function(){
$(function () {
$('[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',
labelField: 'name',
searchField: ['name'],
@@ -61,13 +109,16 @@ setTimeout(function(){
placeholder : "Enter a name for the bag"
});
var selectize = $select[0].selectize;
selectize.clearOptions()
selectize.addOption([].map(function(bagName){
return {name : bagName}
}));
var fileNameSelectize = $fileNameSelect[0].selectize;
fileNameSelectize.clearOptions()
// /aescape/bags/getBagList
getBagList(function(result){
fileNameSelectize.addOption([].map(function(bagName){
return {name : bagName}
}));
})
var $select2 = $('#playBagCategory').selectize({
var $categoryNameSelect = $(categorySelector).selectize({
valueField: 'name',
labelField: 'name',
searchField: ['name'],
@@ -76,14 +127,15 @@ setTimeout(function(){
placeholder : "Enter or select a category for the bag"
});
var selectize2 = $select2[0].selectize;
//selectize.clearOptions()
results2 = ['Production', 'Test'];
selectize2.addOption(results2.map(function(bagName){
return {name : bagName}
}));
var categoryNameSelectize = $categoryNameSelect[0].selectize;
categoryNameSelectize.clearOptions()
getBagCategoryList(function(result){
categoryNameSelectize.addOption(['Production', 'Test'].map(function(bagName){
return {name : bagName}
}));
})
var $select3 = $('#playBagTags').selectize({
var $tagSelect = $(tagSelector).selectize({
valueField: 'name',
labelField: 'name',
searchField: ['name'],
@@ -93,31 +145,14 @@ setTimeout(function(){
placeholder : "Enter or select tags for the bag"
});
var selectize3 = $select3[0].selectize;
//selectize.clearOptions()
results3 = ['single-arm', 'dual-arm', 'palpation', 'demo'];
selectize3.addOption(results3.map(function(bagName){
return {name : bagName}
}));
var tagSelectize = $tagSelect[0].selectize;
tagSelectize.clearOptions()
getBagTagList(function(results){
tagSelectize.addOption(['single-arm', 'dual-arm', 'palpation', 'demo'].map(function(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) {
@@ -137,7 +172,13 @@ function updateBagMetadata(mode, bag_name, modified_bag_name, category, tags) {
if(!bag_name) {
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
})
}