X-Git-Url: https://defiant.homedns.org/gitweb/?p=ros_wild_thumper.git;a=blobdiff_plain;f=www%2Fassets%2Fjavascripts%2Fapplication.js;h=02dfe59f101db11bf15bd00b1eedec34a51bdf95;hp=a7b478517788dee56d68033f3d03647ea96af4e3;hb=99dd1e1236d58a4ee9c93de7124afd83b2f2c141;hpb=a627d4b5aa12d4ea4a72b2dd966237084c64d1e4 diff --git a/www/assets/javascripts/application.js b/www/assets/javascripts/application.js index a7b4785..02dfe59 100644 --- a/www/assets/javascripts/application.js +++ b/www/assets/javascripts/application.js @@ -4,7 +4,7 @@ function init() { var isDragging = false; function connect() { - ros.connect('ws://wildthumper:9090'); + ros.connect('ws://'+robothostname+':9090'); } ros.on('connection', function() { @@ -17,9 +17,9 @@ function init() { ros.on('close', function() { information.alerts.push({message: "Connection to websocket server closed.", info: true}); - setTimeout(function() { - connect(); - }, 2000); + //setTimeout(function() { + // connect(); + //}, 2000); }); //tfClient.subscribe('base_link', function(tf) { @@ -189,12 +189,12 @@ function init() { Y = e.pageY; } // relative click position - var Xrel = X - this.offsetLeft - $(this).width()/2; - var Yrel = Y - this.offsetTop - $(this).height()/2; + var Xrel = X - this.getBoundingClientRect().left - $(this).width()/2; + var Yrel = Y - this.getBoundingClientRect().top - $(this).height()/2; // scale to -1..+1 var trans = -Yrel / ($(this).height()/2); var rot = -Xrel / ($(this).width()/2); - setSpeed(trans, rot*3); + setSpeed(trans*$("#scale_trans").val(), rot*$("#scale_rot").val()); } }); @@ -238,6 +238,9 @@ function init() { // reload $("img").attr("src", $("img").attr("src")) }); + + $("input[type='number']").spinner(); + $("#usb_cam").attr("src", "http://"+robothostname+":8080/stream?topic=/camera/color/image_raw"); } Vue.component('input-value', {