]> defiant.homedns.org Git - ros_wild_thumper.git/commitdiff
www: reconnect after error
authorErik Andresen <erik@vontaene.de>
Fri, 28 Dec 2018 10:50:14 +0000 (11:50 +0100)
committerErik Andresen <erik@vontaene.de>
Fri, 28 Dec 2018 10:50:14 +0000 (11:50 +0100)
www/assets/javascripts/application.js
www/index.html

index 3f85f00359078679d2be5b09d15aa8acb4c06d94..a7b478517788dee56d68033f3d03647ea96af4e3 100644 (file)
@@ -1,8 +1,12 @@
 function init() {
        var ros = new ROSLIB.Ros();
-       ros.connect('ws://wildthumper:9090');
+       connect();
        var isDragging = false;
 
+       function connect() {
+               ros.connect('ws://wildthumper:9090');
+       }
+
        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});
+               setTimeout(function() {
+                       connect();
+               }, 2000);
        });
 
        //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', {
index 837640514b4e66b80b4de6b72cec6a8c6b0100fc..7a867656a9dc954e1e78297e8a294a1da02bb083 100644 (file)
@@ -47,6 +47,9 @@
                                        <li class="nav-item">
                                                <a class="nav-link" href="#drive" data-toggle="tab" role="tab">Drive</a>
                                        </li>
+                                       <li class="nav-item">
+                                               <a class="nav-link imagelink" href="#image" data-toggle="tab" role="tab">Image</a>
+                                       </li>
                                </ul>
                        </nav>
 
                                <div id="drive" class="tab-pane" role="tabpanel">
                                        <div class="cmd_vel_circle"></div>
                                </div>
+                               <div id="image" class="tab-pane" role="tabpanel">
+                                       <img id="usb_cam" src="http://wildthumper:8080/stream?topic=/usb_cam/image_raw" style="transform:rotate(-90deg); transform-origin: 60% 60%;"></img>
+                               </div>
                        </div>
                </div>
        </body>