Merge branch 'master' of ssh://vontaene/home/erik_alt/git/ros_wild_thumper
authorErik Andresen <erik@vontaene.de>
Thu, 2 Apr 2020 05:19:58 +0000 (07:19 +0200)
committerErik Andresen <erik@vontaene.de>
Thu, 2 Apr 2020 05:19:58 +0000 (07:19 +0200)
1  2 
www/assets/javascripts/application.js
www/index.html

@@@ -4,7 -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() {
                                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());
                }
        });
  
                // reload
                $("img").attr("src", $("img").attr("src"))
        });
 +
 +      $("input[type='number']").spinner();
  }
  
  Vue.component('input-value', {
diff --combined www/index.html
@@@ -21,6 -21,9 +21,9 @@@
                <script src="assets/javascripts/jquery.minicolors.js"></script>
                <script src="assets/javascripts/vue.js"></script>
                <script src="assets/javascripts/application.js"></script>
+               <script type="text/javascript">
+                       robothostname="wildthumper"
+               </script>
  
                <title>Wild Thumper control</title>
        </head>
                                        </div>
                                </div>
                                <div id="drive" class="tab-pane" role="tabpanel">
 -                                      <div class="cmd_vel_circle"></div>
 +                                      <div class="row">
 +                                              <div class="col-sd-10">
 +                                                      <div class="cmd_vel_circle"></div>
 +                                              </div>
 +                                              <div class="col-sd-1">
 +                                                      <input type="number" value="1.0" min="0.1" max="5.0" step="0.1" class="form-control" id="scale_trans">
 +                                                      <input type="number" value="3.0" min="1.0" max="5.0" step="0.1" class="form-control" id="scale_rot">
 +                                              </div>
 +                                      </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>
+                                       <img id="usb_cam" src="http://"+robothostname+":8080/stream?topic=/usb_cam/image_raw" style="transform:rotate(-90deg); transform-origin: 60% 60%;"></img>
                                </div>
                        </div>
                </div>