]> defiant.homedns.org Git - ros_wild_thumper.git/commitdiff
www/lights: Support multiple leds at once
authorErik Andresen <erik@vontaene.de>
Fri, 26 Jan 2018 21:45:55 +0000 (22:45 +0100)
committerErik Andresen <erik@vontaene.de>
Fri, 26 Jan 2018 21:45:55 +0000 (22:45 +0100)
scripts/gps_follow_waypoints.py
www/index.html

index e2405f51664c47331524dc6c29f148ec76e05761..78eaea5a6715cbc093f172332f4d0ec56c54561f 100755 (executable)
@@ -64,7 +64,7 @@ class GPSGotoCoords:
                if self.move_base.get_state() == GoalStatus.SUCCEEDED:
                        rospy.loginfo("The base moved to (%f, %f)" % (lat, lon))
                else:
-                       rospy.logerr("The base failed to (%f, %f)" % (lat, lon))
+                       rospy.logerr("The base failed to (%f, %f). Error: %d" % (lat, lon, self.move_base.get_state()))
                        exit(1)
 
        def on_shutdown(self):
index 5a229a790278504a0b9310f78255fe30703823c8..87da1eaf2281a5f03543f67c4ef218d8af046f82 100644 (file)
@@ -9,6 +9,9 @@
 
                <style>
                .minicolors-theme-default.minicolors { margin: 5px; }
+               .bottom-leds > .minicolors-theme-default.minicolors { margin: 5px 0; }
+               .top-leds > .minicolors-theme-default.minicolors { margin-top: 70px; }
+               .wt-icon {background: url('assets/images/wt_top.png'); background-size: cover; background-size: 100%; background-repeat: no-repeat; background-position: center; height: 260px;}
                </style>
 
                <script type="text/javascript">
                                defaultValue: '#000000',
                                change: function(value) {
                                        var rgb = $(this).minicolors('rgbObject');
-                                       var num = $(this).prop("name");
+                                       var nums = jQuery.parseJSON($(this).prop("name"));
                                        var msg = new ROSLIB.Message({
-                                               leds: [{
-                                                       num: parseInt(num),
+                                               leds: []
+                                       });
+                                       jQuery.each(nums, function(i, num) {
+                                               msg["leds"].push({
+                                                       num: num,
                                                        red: parseInt(rgb.r*127/255),
                                                        green: parseInt(rgb.g*127/255),
                                                        blue: parseInt(rgb.b*127/255)
-                                               }]
+                                               })
                                        });
                                        ledStripeTopic.publish(msg);
                                }
                                        <div id="speed-slider"></div>
                                </div>
                                <div id="lights" class="tab-pane" role="tabpanel">
-                                       <div class="row d-flex align-items-center">
-                                               <div class="col-md-1">
-                                                       <div class="float-right align-middle">
-                                                               <input class="led_color" type="hidden" name="15"/>
-                                                               <input class="led_color" type="hidden" name="14"/>
-                                                       </div>
-                                               </div>
-                                               <div class="col-md-2" >
+                                       <div class="row">
+                                               <div class="col-md-2 offset-md-1" >
                                                        <div class="d-flex justify-content-center">
-                                                               <input class="led_color" type="hidden" name="0"/>
-                                                               <input class="led_color" type="hidden" name="1"/>
-                                                               <input class="led_color" type="hidden" name="2"/>
-                                                               <input class="led_color" type="hidden" name="3"/>
+                                                               <input class="led_color" type="hidden" name="[0]"/>
+                                                               <input class="led_color" type="hidden" name="[1]"/>
+                                                               <input class="led_color" type="hidden" name="[2]"/>
+                                                               <input class="led_color" type="hidden" name="[3]"/>
                                                        </div>
                                                        <div>
-                                                               <div style="background: url('assets/images/wt_top.png'); background-size: cover; background-size: 100%; background-repeat: no-repeat; height: 260px;">
-                                                                       <div class="d-flex justify-content-center" style="padding-top: 70px;">
-                                                                               <input class="led_color" type="hidden" name="7"/>
-                                                                               <input class="led_color" type="hidden" name="6"/>
-                                                                               <input class="led_color" type="hidden" name="5"/>
-                                                                               <input class="led_color" type="hidden" name="4"/>
+                                                               <div class="row wt-icon">
+                                                                       <div class="col-md-2 align-self-center bottom-leds">
+                                                                               <input class="led_color" type="hidden" name="[14]"/>
+                                                                               <input class="led_color" type="hidden" name="[15]"/>
+                                                                       </div>
+                                                                       <div class="col-md-8">
+                                                                               <div class="d-flex justify-content-center top-leds">
+                                                                                       <input class="led_color" type="hidden" name="[7]"/>
+                                                                                       <input class="led_color" type="hidden" name="[6]"/>
+                                                                                       <input class="led_color" type="hidden" name="[5]"/>
+                                                                                       <input class="led_color" type="hidden" name="[4]"/>
+                                                                               </div>
+                                                                       </div>
+                                                                       <div class="col-md-2 align-self-center bottom-leds">
+                                                                               <input class="led_color" type="hidden" name="[13]"/>
+                                                                               <input class="led_color" type="hidden" name="[12]"/>
                                                                        </div>
                                                                </div>
                                                        </div>
                                                        <div class="d-flex justify-content-center">
-                                                               <input class="led_color" type="hidden" name="8"/>
-                                                               <input class="led_color" type="hidden" name="9"/>
-                                                               <input class="led_color" type="hidden" name="10"/>
-                                                               <input class="led_color" type="hidden" name="11"/>
+                                                               <input class="led_color" type="hidden" name="[8]"/>
+                                                               <input class="led_color" type="hidden" name="[9]"/>
+                                                               <input class="led_color" type="hidden" name="[10]"/>
+                                                               <input class="led_color" type="hidden" name="[11]"/>
                                                        </div>
                                                </div>
-                                               <div class="col-md-1">
-                                                       <div class="float-left align-middle">
-                                                               <input class="led_color" type="hidden" name="13"/>
-                                                               <input class="led_color" type="hidden" name="12"/>
+                                               <div class="col-md-3 offset-md-1">
+                                                       <div class="form-group row">
+                                                               <label class="col-sm-2 col-form-label">Alle</label>
+                                                               <div class="col-sm-10">
+                                                                       <input class="led_color" type="text" name="[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]" class="form-control"/>
+                                                               </div>
+                                                       </div>
+                                                       <div class="form-group row">
+                                                               <label class="col-sm-2 col-form-label">Front</label>
+                                                               <div class="col-sm-10">
+                                                                       <input class="led_color" type="text" name="[0, 1, 2, 3]" class="form-control"/>
+                                                               </div>
+                                                       </div>
+                                                       <div class="form-group row">
+                                                               <label class="col-sm-2 col-form-label">Aft</label>
+                                                               <div class="col-sm-10">
+                                                                       <input class="led_color" type="text" name="[8, 9, 10, 11]" class="form-control"/>
+                                                               </div>
+                                                       </div>
+                                                       <div class="form-group row">
+                                                               <label class="col-sm-2 col-form-label">Top</label>
+                                                               <div class="col-sm-10">
+                                                                       <input class="led_color" type="text" name="[4, 5, 6, 7]" class="form-control"/>
+                                                               </div>
+                                                       </div>
+                                                       <div class="form-group row">
+                                                               <label class="col-sm-2 col-form-label">Bottom</label>
+                                                               <div class="col-sm-10">
+                                                                       <input class="led_color" type="text" name="[12, 13, 14, 15]" class="form-control"/>
+                                                               </div>
                                                        </div>
                                                </div>
                                        </div>