BH TEAM

METTEZ UN PYTHON DANS VOTRE
MOTEUR ROBOT !
YANNICK
@yanjost
yannick (at) yjost.com
Pythonista depuis 1.4
BH Team depuis 2009
9 participations à la Coupe de France de Robotique
La Plage Digitale
ERIC
@eric_alber
eric.alber (at) gmail.com
Pythonista depuis 2.4
BH Team depuis 2010
7 participations à la Coupe de France de Robotique
BH TEAM
6 personnes
Strasbourg, Belfort, Lyon
Depuis 2007
Meilleur classement : vice-champions de France (2011)
Ouéééééé
Dernier classement : 19 / 146
www.bhteam.org / @thebhteam
LA COUPE DE FRANCE DE ROBOTIQUE
DE QUOI EST FAIT UN ROBOT ?
COMMENT CODER LA STRATÉGIE POUR
LE ROBOT ?
Multiples entrées-sorties (USB / Ethernet)
Communication asynchrone entre les composants
Tolérance aux erreurs
Pas besoin de hautes performances
Langage de haut niveau
Rapidité de modification
Utiliser des paradigmes modernes
Stacktrace
Bref "batteries included"
BREWERY !
Framework dédié à la robotique
Basé sur asyncore
Existe depuis 2010 (Lua → Python)
Evénementiel
Entrées multiplexées
ARCHITECTURE GÉNÉRALE
GESTION DES MACHINES À ÉTAT
GESTION DES MACHINES À ÉTAT
SHOW ME THE CODE !
casMi(tt)
ls anSae:
dfo_ne(ef:
e netrsl)
yedMvTGas..
il oeols(.)
yedTkGas..
il aels(.)

#Sic t saeMvTGas
wth o tt oeols
#Sic t saeTkGas
wth o tt aels

casMvtGasSae:
ls oeols(tt)
dfo_ne(ef:
e netrsl)
yedMvLn(oiin1 #Sic t saeMvLn,
il oeiepsto_)
wth o tt oeie
#mv t psto 1
oe o oiin
yedMvLn(oiin2 #Sic t saeMvLn,
il oeiepsto_)
wth o tt oeie
#mv t psto 2
oe o oiin
yedNn
il oe
#Ppbc t saeMi
o ak o tt an
casTkGasSae:
ls aels(tt)
dfo_ne(ef:
e netrsl)
yedCoerpe(.)
il lsGipr..
yedNn
il oe

#Sic t saeCoerpe
wth o tt lsGipr
#Ppbc t saeMi
o ak o tt an
STATE MACHINE PARALLÈLE
casDPrle(tt)
ls oaallSae:
dfo_ne(ef:
e netrsl)
l =Saeahn(bra" sd =SD_ET #Satprle FM
b
ttMcie"amn, ie
IELF)
tr aall S
r =Saeahn(bra" sd =SD_IH)#frec sd
b
ttMcie"amn, ie
IERGT
o ah ie
yedMvLn(.,00 #Mv t satpsto
il oeie10 .)
oe o tr oiin
yedNn
il oe

#Ppsae
o tt
LE PROTOCOLE BH TEAM
KISS
Paquet TCP 256 octets
1 octet : type
255 octets : data
Basé sur s r c
tut
Ordres
Ouverture / fermeture actionneurs
Paramétrage
Ordres de déplacement
SÉRIALISATION
API déclarative
Types de données
UInt
Float
Tableaux
Enum
Booléen
EXEMPLE
casTreDtc(aeakt:
ls urteetBsPce)
TP =3
YE
2
DFNTO =(
EIIIN
(dsac' Un8(,"eeto dsac" )
'itne, It 0 Dtcin itne) ,
(age
'nl' ,Un8(,"eeto age))
It 0 Dtcin nl" ,
(rbt
'oo' ,Unm(POETRBT OPNN_OO_AN )
Eu8OPNN_OO, POETRBTMI) ,
)

Introspection des paquets
Visualisation des logs
Génération des paquets pour l'interface web
UTILISATION
Mapping automatique de méthode basé sur le nom du
paquet
TurretDetect : on_turret_detect(packet)
GotoFinished : on_goto_finished(packet)
casMOjc:
ls ybet
dfo_urtdtc(akt:
e ntre_eetpce)
pit"eevdpce,dsac=}.omtpce.itne)
rn(Rcie akt itne{"fra(aktdsac)
m_bet=MOjc(
yojc
ybet)
p=TreDtc(
urteet)
#Ti clsm_beto_urtdtc()
hs al yojc.ntre_eetp
pdsac(yojc)
.ipthm_bet
CALCUL DE TRAJECTOIRE
Utilisation d'une "carte" du terrain
Mise à jour en fonction de l'état des capteurs
Problème de rapidité → réécriture en C
PRISE DE DÉCISION : GOAL MANAGER
Heuristique
Objectifs restants réalisés par le robot et son acolyte
Utilisation du pathfinding :
Distance des objectifs
Position de l'adversaire
Pas d'ordre défini mais pondération des objectifs
UTILISATION D'UNE CAMÉRA
C++, OpenCV
Invocation d'un subprocess
Très fiable
ONE MORE
THING...
SIMULATION
PAQUETS ÉCHANGÉS
TRAJECTOIRE DEMANDÉE & RÉELLE
VITESSE DÉPLACEMENT
VITESSE ROTATION
WHAT'S NEXT ?
Unifier appels inter-module et les évènements
Moteur physique dans le simulateur
Améliorer communication entre les robots
Traitement d'image plus complexe
Faire un package réutilisable
POUR EN SAVOIR PLUS
The source code : http://bitbucket.org/bhteam
Twitter : @thebhteam
Facebook : TheBhTeam
Site : http://www.bhteam.org
MERCI AUX SPONSORS !

{ yucmaylg }
{ oropn.oo }
CONCLUSIONS
OUI : Python et robotique font bon ménage
NON : Python ne peut pas tout faire
Gain de productivité / vitesse de dev
"Pas testé, pas validé !"
Contents de notre choix !
CRÉDIT PHOTO
http://www.mirror.co.uk/news/world-news/pythonfound-in-car-engine-16-ft-1309075
Marc Obergfell
Wat Horse : http://t.qkme.me/3ttns0.jpg
http://www.ludumdare.com/compo/wpcontent/uploads/2013/04/i-have-no-idea-what-imdoing-dog.jpg
http://madan.wordpress.com/2007/01/06/kurukshetrarobotics-at-anna-university/
le reste : (c) BH Team

BH Team - Mettez un python dans votre robot !