Thymios as a flower

This page presents a construction with several Thymio II robots working together. The result is a flower with a 75 cm diameter. It is made of 6 petals, each of which is moved by a Thymio II robot.

big-flower-700.jpg

The Thymio II robots are mounted on a wooden structure which holds them in a star-shaped form. The wooden pieces are held together by means of specially machined slots:

structure.jpg

The wheels are fixed to the wooden structure with plastic pins. The wheels cannot move relative to the structure.

attachment.jpg

Finally the petals are fixed to the Thymios. To make it look better, two layers of tissue are used. The centre of the flower is a polystyrene hemisphere painted yellow.

petale.jpg

Once this construction is completed, there is some programming needed to make all the petals move simultaneously. This is achieved with an infrared remote control and this special program for the Thmyio II:

#################################################
# Thymio Fleur
# version 2.2
#################################################

##############
# Variable   #
##############
var i = 0
var temp = 0
var count = 0
var startRegul = 0
var withLED = 0
var LEDval = 0
var slowDown = 0

var accTamponPos = 0
var accTampon[TAILLE_TAMPON]
var accTampon2[TAILLE_TAMPON]
var sumacc1 = 0
var sumacc2 = 0

var TOPVALUE = -4
var BOTVALUE = -160

var projacc = 0
var consigne = 0
var ecart = 0

##############
# init   #
##############
call leds.rc(0)
call leds.sound(0)
call leds.temperature(0, 0)
call leds.buttons(0,0,0,0)
call leds.circle(0,0,0,0,0,0,0,0)
#call leds.prox.h(32,32,32,32,32,32,0,0)
#call leds.prox.v(32,32)
motor.left.target =  0
motor.right.target = 0

timer.period[0] = 100
################################
sub refreshLEDs
    temp = 32*startRegul
    call leds.temperature(0, temp)
    call leds.sound(temp)

################################
sub ledDimup
        if  withLED == 0 then
            call leds.rc(0)
            call leds.sound(0)
            call leds.temperature(0, 0)
            call leds.buttons(0,0,0,0)
            call leds.prox.h(0,0,0,0,0,0,0,0)
            call leds.prox.v(0,0)
            call leds.top(0, 0, 0)
            call leds.bottom.left(0, 0, 0)
            call leds.bottom.right(0, 0, 0)
        else
            call leds.rc(LEDval)
            call leds.temperature(LEDval, 0)
            call leds.buttons(LEDval,LEDval,LEDval,LEDval)
            call leds.prox.h(LEDval,LEDval,LEDval,LEDval,LEDval,LEDval,LEDval,LEDval)
            call leds.prox.v(LEDval,LEDval)
            call leds.top(LEDval, 0, 0)
            call leds.bottom.left(LEDval, 0, 0)
            call leds.bottom.right(LEDval, 0, 0)
        end
###############################
onevent acc
        accTampon2[accTamponPos] = acc[1]
        accTampon[accTamponPos] = acc[2]
        accTamponPos = (accTamponPos + 1) % TAILLE_TAMPON
        sumacc1 = 0
        sumacc2 = 0

        for i in 1:TAILLE_TAMPON do
            sumacc1 += accTampon[TAILLE_TAMPON-1] 
            sumacc2 += accTampon2[TAILLE_TAMPON-1] 
        end
        call math.atan2(projacc, sumacc1, sumacc2)

        projacc /= 100
        ecart = projacc - consigne

        if startRegul == 1 and (abs(ecart) > ECART_MIN) then
            motor.left.target  = ecart*AMPLI #- prox.horizontal[6]/200 +10
            motor.right.target = ecart*AMPLI #- prox.horizontal[6]/200 +10
        else
            motor.left.target =  0
            motor.right.target = 0
        end

        if  withLED == 1 then
            if  projacc < 0 then
                LEDval = (projacc/20)^2
            else
                projacc = 0
            end
            LEDval = -projacc/10
            callsub ledDimup
        end

###############################
# initialisation des valeur top et bottom
onevent button.forward
    TOPVALUE = projacc-4
    call leds.prox.h(0,0,0,0,0,0,0,0)

onevent button.backward
    BOTVALUE = projacc+4
    call leds.prox.v(0,0)
    consigne = BOTVALUE

###############################
# Telecommande
onevent rc5
    if    rc5.command == 50 then #play
        startRegul = 1 
    elseif   rc5.command == 54 or rc5.command == 12 then #stop
        motor.left.target =  0
        motor.right.target = 0
        startRegul = 0    
    elseif   rc5.command == 52 then #fwd
        consigne = BOTVALUE
    elseif   rc5.command == 55 then #rew
        consigne = TOPVALUE

    elseif  rc5.command == 32 then #chan+
        if consigne <= TOPVALUE then
            consigne += 8
        end
    elseif   rc5.command == 33 then #chan-
        if consigne >= BOTVALUE then
            consigne -= 8
        end
    elseif  rc5.command == 16 then #Vol+
        withLED = 2
        LEDval  +=1
        callsub ledDimup
    elseif   rc5.command == 17 then #vol-
        withLED = 2
        LEDval -=1
        callsub ledDimup

    elseif rc5.command == 1 then #1 -> slowUP
        slowDown = -1
        startRegul = 1    
        withLED = 1
        callsub ledDimup

    elseif rc5.command == 2 then #2 -> stop LED stop regul
        startRegul = 0
        withLED = 0
        callsub ledDimup

    elseif rc5.command == 3 then #3 -> slow down
        slowDown = 1
        startRegul = 1    
        withLED = 1

    elseif rc5.command == 4 then #4 -> Start LEDS, stop regul
        startRegul = 0    
        withLED = 2
        LEDval = 32
        callsub ledDimup

    elseif rc5.command == 56 then #TV -> very slow down
        slowDown = 2
        startRegul = 1    
        withLED = 1

    elseif rc5.command == 14 then #rec
        withLED = abs(withLED-1)        
    end

###############################
# Consigne en rampe.
onevent timer0
    if slowDown == 1 then
        consigne -= MICRO_STEP
        if  consigne < BOTVALUE then
            consigne = BOTVALUE
            slowDown = 0
        end
    elseif slowDown == -1 then
        consigne += MICRO_STEP
        if  consigne >TOPVALUE then
            consigne = TOPVALUE
            slowDown = 0
        end
    end

###############################
# Rampe très lente
onevent temperature # chaque seconde
    if slowDown == 2 then
        count++
        if  count == SLOOOWCOUNT  then
            count = 0
            consigne -= MICRO_STEP
            if  consigne < BOTVALUE then
                consigne = BOTVALUE
                slowDown = 0
            end
        end
    end

This code uses constants, so download it here: CODE

All together this gives the following effect:

If it is all correctly set up, one can get the result show in this video:

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License