]> defiant.homedns.org Git - ros_wild_thumper.git/blobdiff - www/assets/javascripts/application.js
www: reconnect after error
[ros_wild_thumper.git] / www / assets / javascripts / application.js
index 3f85f00359078679d2be5b09d15aa8acb4c06d94..a7b478517788dee56d68033f3d03647ea96af4e3 100644 (file)
@@ -1,8 +1,12 @@
 function init() {
        var ros = new ROSLIB.Ros();
 function init() {
        var ros = new ROSLIB.Ros();
-       ros.connect('ws://wildthumper:9090');
+       connect();
        var isDragging = false;
 
        var isDragging = false;
 
+       function connect() {
+               ros.connect('ws://wildthumper:9090');
+       }
+
        ros.on('connection', function() {
                information.alerts.push({message: "Connected to websocket server.", success: true});
        });
        ros.on('connection', function() {
                information.alerts.push({message: "Connected to websocket server.", success: true});
        });
@@ -13,6 +17,9 @@ function init() {
 
        ros.on('close', function() {
                information.alerts.push({message: "Connection to websocket server closed.", info: true});
 
        ros.on('close', function() {
                information.alerts.push({message: "Connection to websocket server closed.", info: true});
+               setTimeout(function() {
+                       connect();
+               }, 2000);
        });
 
        //tfClient.subscribe('base_link', function(tf) {
        });
 
        //tfClient.subscribe('base_link', function(tf) {
@@ -227,6 +234,10 @@ function init() {
                }
        })
 
                }
        })
 
+       $(".imagelink").on('click',function(){
+               // reload
+               $("img").attr("src", $("img").attr("src"))
+       });
 }
 
 Vue.component('input-value', {
 }
 
 Vue.component('input-value', {