Ankündigung

Einklappen
Keine Ankündigung bisher.

Roomba Wigdet

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    [Codebeispiel] Roomba Wigdet

    Ich habe mich mal an einem Widget versucht, dabei ist was rausgekommen
    Zwei Fragen bleiben:
    Gibt es eine zentrale Stelle an der Widgets gesammelt werden oder ziehen die irgendwann automatisch in neue Releases ein?
    Ist zum positionieren der Buttons zwangsweise eine separate CSS notwendig? Ich hab von HTML und js nicht so den Plan. Nen Schönheitspreis gewinnt das dadurch leider nicht.




    widget_roomba.html
    Code:
    /**
    * Roomba Control
    *
    * @param unique id for this widget
    * @param the gad/item for clean
    * @param the gad/item for stop
    * @param the gad/item for dock
    * @param the gad/item for forward
    * @param the gad/item for backward
    * @param the gad/item for left rotation
    * @param the gad/item for right rotation
    *
    * @author Mirko Hirsch
    */
    {% macro roomba(id, clean, stop, dock, forward, backward, left, right) %}
            {% import "basic.html" as basic %}
            {% set uid = uid(page, id) %}
    
            <div id="{{ uid }}" class="roomba">
    		
                    <div class="roomba_control">
    			{% if clean %} {{ basic.button(id~'clean', clean, 'Start', icon0~'scene_robo_vac_cleaner.png', '1', 'midi') }} {% endif %}
    			{% if dock %} {{ basic.button(id~'dock', dock, 'Dock', icon0~'control_building_empty.png', '1', 'midi')}} {% endif %}
    		</div>
    		
    		<div class="drive_first">
    			{% if forward %} {{ basic.button(id~'forward', forward, '', 'arrow-u', 1) }} {% endif %}
    		</div>
    		<div class="drive_second">
    			{% if left %} {{ basic.button(id~'left', left, '', 'back', 1) }} {% endif %}
    			{% if stop %} {{ basic.button(id~'stop', stop, '', icon0~'message_stop.png', 1) }} {% endif %}
    			{% if right %} {{ basic.button(id~'right', right, '', 'forward', 1) }} {% endif %}
    		</div>
    		<div class="drive_third">
    			{% if backward %} {{ basic.button(id~'back', backward, '', 'arrow-d', 1) }} {% endif %}
    		</div>
            </div>
    {% endmacro %}
    visu.css
    Code:
    /**
     * -----------------------------------------------------------------------------
     * @package     smartVISU
     * @author      Martin Gleiß
     * @copyright   2012
     * @license     GPL [http://www.gnu.de]
     * ----------------------------------------------------------------------------- 
     */
    
    @CHARSET "UTF-8";
    
    .roomba .roomba_control {
    	position: relative;
            margin-left: -50%;
    }
    
    .roomba .drive_first {
    	position: relative;
            margin-left: auto;
            margin-right: auto;
            top: 50%;
            left: 0;
            right: 0;
    }
    .roomba .drive_second {
    	position: relative;
            margin-left: 0px;
            margin-right: auto;
            top: 0px;
            left: 0;
            right: 0;
    }
    .roomba .drive_third {
    	position: relative;
            margin-left: auto;
            margin-right: auto;
            top: 0px;
            left: 0;
            right: 0;
    }

    README.md
    Code:
    # Roomba widget
    
    # Supported Commands
    <pre>
    macro roomba(id, gad_clean, gad_stop, gad_dock, gad_forward, gad_backward, gad_left, gad_right)
    </pre>
    # Examples
    
    ~~~
            <div class="block">
            <div class="set-2" data-role="collapsible-set" data-theme="c" data-content-theme="a" data-mini="true">
            <div data-role="collapsible" data-collapsed="false">
                    <h3>Roomba</h3>
                    {% import "widget_roomba.html" as roomba %}
                    {{ roomba.roomba('roomba_1','roomba.command.clean','roomba.raw.stop','roomba.command.dock','roomba.forward','roomba.backward','roomba.left','roomba.right') }}
                </div>
            </div>
            </div>
    ~~~
    Angehängte Dateien
    Umgezogen? Ja! ... Fertig? Nein!
    Baustelle 2.0 !

    #2
    Ja cool.

    Wenns komplett fertig ist, dann füge ich das gerne hinzu. Würde es aber device.hoover nennen, wir wollen ja wenn möglich Marken unabhängig bleiben.

    Wichtig wäre noch eine docu-Seite, und saubere Kommentare.

    Ansonsten einfach mir senden.

    Gruss
    Join smartVISU on facebook. Web: smartvisu.de.
    Dir gefällt smartVISU? Bitte spenden für die Weiterentwicklung.

    Kommentar


      #3
      Hi Mirko,
      yo, ist zwar peinlich aber ich komme tatsächlich jetzt erst dazu mich mal wieder der SV und dem Roomba-Plugin zu widmen...
      Anyway, irgendwie habe ich Probleme das Widget mit dem Plugin zusammenzubekommen da mir Left, Right, Forward, Backward nicht in der Bsp.-Items.conf finden kann. Könntest Du mir hier bitte mal kurz auf die Sprünge helfen oder gibt es bzgl. Plugin/Widget irgendwelche neuen Versionen?

      Vielen Dank!
      Cheers,
      Oliver

      Kommentar


        #4
        Hallo Oliver,

        ich verwende aufgrund eines Totalschadens an meiner Platine das Plugin nicht mehr. Ausserdem hatte ich Probleme mein Bluetooth stabil durchs Wohnzimmer zu bekommen. Aber das Plugin aus dem Git sollte tatsächlich die letzte Version sein und sollte sich auch wiederverbinden wenn der Roomba wieder in Reichweite ist.
        Die Fahrbefehle habe ich wirklich nicht dokumentiert ... Schande !

        Am Widget hab ich nicht weiter gebastelt da ich mit css auf Kriegsfuß stehe. Ich hab ehrlich gesagt immer noch nicht rausbekommen ob css nicht vielleicht was zum essen ist.

        Hier aber mal meine alte roomba.conf:

        Code:
        [test]
        type = bool
        enforce_updates = true
        roomba_raw = 128
        
        [left]
        type = bool
        enforce_updates = true
        roomba_cmd = spin_left
        
        [right]
        type = bool
        enforce_updates = true
        roomba_cmd = spin_right
        
        [back]
        type = bool
        enforce_updates = true
        roomba_cmd = backward
        
        [vor]
        type = bool
        enforce_updates = true
        roomba_cmd = forward
        
        [stop]
        type = bool
        enforce_updates = true
        roomba_raw = 137 | 0 | 0 | 0
        
        [drive]
        type = bool
        enforce_updates = true
        roomba_cmd = backward | 1 | spin_left | 1 | spin_right | 1 | forward | 1 | stop | clean | 10 | stop | 2 | dock
        
        [drive2]
        type = bool
        enforce_updates = true
        roomba_cmd = backward | 5 | stop | 5 | dock
        
        
        [roomba]
            [[command]]
                [[[clean]]]
                    enforce_updates = true
                    name = clean
                    type = bool
                    roomba_cmd = clean
                [[[dock]]]
                    enforce_updates = true
                    name = dock
                    type = bool
                    roomba_cmd = dock
                [[[power_off]]]
                    enforce_updates = true
                    name = power_off
                    type = bool
                    roomba_cmd = power_off
                [[[spot]]]
                    enforce_updates = true
                    name = spot
                    type = bool
                    roomba_cmd = spot
                [[[max]]]
                    enforce_updates = true
                    name = max
                    type = bool
                    roomba_cmd = max
                [[[test_scene]]]
                    enforce_updates = true
                    #drives backward for 2 seconds, then spins left for 2 seconds, then drives forward for 3 seconds, then spins right for 3 seconds, then stops and starts to clean after 2 seconds
                    name = test-drive
                    type = bool
                    roomba_cmd = backward | 2 | spin_left | 2 | forward | 3 | spin_right | 3 | stop | 2 | clean
                    
            [[raw]]
                [[[stop]]]
                type = bool
                enforce_updates = true
                roomba_raw = 137 | 0 | 0 | 0
                
            [[sensor]]
                [[[current]]]
                    #current in mA
                enforce_updates = true
                    type = num
                    roomba_get = current
                    rrd = 1
                [[[temperature]]]
                    #temperature in degrees celsius
                    enforce_updates = true
                    type = num
                    roomba_get = temperature
                [[[voltage]]]
                    #voltage in mV
                enforce_updates = true
                    type = num
                    roomba_get = voltage
                    rrd = 1     
                [[[button_clean]]]
                    #clean button pressed
                enforce_updates = true
                    type = bool
                    roomba_get = buttons_clean
                [[[capacity]]]
                    #capacity in mA
                    enforce_updates = true
                    type = num
                    roomba_get = capacity
                [[[charge]]]
                    #charge in mA
                enforce_updates = true
                    type = num
                    roomba_get = charge
                    rrd = 1
                [[[angle]]]
                    #angle since last request
                    enforce_updates = true
                    type = num
                    roomba_get = angle
                [[[distance]]]
                    #distance since last request
                    enforce_updates = true
                    type = num
                    roomba_get = distance
                [[[buttons_max]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = buttons_max
                [[[buttons_clean]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = buttons_clean
                [[[buttons_spot]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = buttons_spot
                [[[buttons_power]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = buttons_power
                [[[remote_opcode]]]
                    enforce_updates = true
                    type = num
                    roomba_get = remote_opcode
                [[[dirt_detect_right]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = dirt_detect_right
                [[[dirt_detect_left]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = dirt_detect_left
                [[[motor_overcurrent_side_brush]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = motor_overcurrent_side_brush
                [[[motor_overcurrent_vacuum]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = motor_overcurrent_vacuum
                [[[motor_overcurrent_main_brush]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = motor_overcurrent_main_brush
                [[[motor_overcurrent_drive_left]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = motor_overcurrent_drive_left
                [[[virtual_wall]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = virtual_wall
                [[[cliff_right]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = cliff_right
                [[[cliff_front_right]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = cliff_front_right
                [[[cliff_front_left]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = cliff_front_left
                [[[cliff_left]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = cliff_left
                [[[wall]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = wall
                [[[bumps_wheeldrops_bump_right]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = bumps_wheeldrops_bump_right
                [[[bumps_wheeldrops_bump_left]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = bumps_wheeldrops_bump_left
                [[[bumps_wheeldrops_wheeldrop_right]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = bumps_wheeldrops_wheeldrop_right
                [[[bumps_wheeldrops_wheeldrop_left]]]
                    enforce_updates = true
                    type = bool
                    roomba_get = bumps_wheeldrops_wheeldrop_left
                [[[bumps_wheeldrops_wheeldrop_caster]]]
                    enforce_updates = true
                    type = bool
                    roomba_cmd = bumps_wheeldrops_wheeldrop_caster

        Bei Fragen einfach melden! Ich bin Dir eh noch was schuldig ... denk dran das mal zu klären



        Umgezogen? Ja! ... Fertig? Nein!
        Baustelle 2.0 !

        Kommentar

        Lädt...
        X