Un nouveau système d’exploitation pour le robot mobile MRPiZ basé sur Raspbian Buster.
https://www.macerobotics.com/Documentation/MRPiZ/Os/MRPiZ_Os_V2.0.zip
Un nouveau système d’exploitation pour le robot mobile MRPiZ basé sur Raspbian Buster.
https://www.macerobotics.com/Documentation/MRPiZ/Os/MRPiZ_Os_V2.0.zip
Une vidéo du robot MRPiZ avec le capteur de gestes 3D Flick:
Le programme en langage python:
#!/usr/bin/env python import sys from mrpiZ_lib import * import time import flicklib from copy import copy import subprocess def message(value): print value @flicklib.move() def move(x, y, z): global xyz xyz = [x,y,z] def main(): time_PasDetection = 0 global xyz xyz = [0,0,0] old_xyz = [0,0,0] deplacement_axeX = 0 print "Exemple" while True: if old_xyz != xyz: deplacement_axeX = xyz[0] deplacement_axeY = xyz[1] print "X", deplacement_axeX print "Y", deplacement_axeY if(deplacement_axeX < 0.35): print "avancer" forward(25) if(deplacement_axeX > 0.75): print "reculer" back(25) if((deplacement_axeY > 0.75)and(deplacement_axeX > 0.35)and(deplacement_axeX < 0.75)): print "tourner droite" turnRight(25) if((deplacement_axeY < 0.5)and(deplacement_axeX > 0.35)and(deplacement_axeX < 0.75)): print "tourner gauche" turnLeft(25) time.sleep(0.5) #stop() else: print "pas de detection" time_PasDetection = time_PasDetection + 1 if(time_PasDetection > 5): stop() time_PasDetection = 0 old_xyz = copy(xyz) time.sleep(0.2) if __name__ == "__main__": main()
Simulation d’un servomoteur de modélisme avec Processing:
Le programme complet:
// simulation d'un servomoteur int angleServomoteur=0; void setup() { // taille de la fenetre size(800, 400);// largeur, hauteur // couleur du fond background(255); } void draw() { float radian; float pox, poy; clear(); background(255); strokeWeight(4); // Thicker // conversion degre radian radian = (angleServomoteur * 3.14)/180; pox = int(cos(radian)*100); poy = int(sin(radian)*100); fill(204, 102, 0);// couleur du cercle (RGB) // dessine cercle pour représenter servomoteur ellipse(400, 100, 50, 50); // dessine ligne line(400,100,int(pox)+400,100-int(poy)); text("Angle:", 12, 45, -30); text(angleServomoteur, 50, 45, -30); if (keyPressed) { if (key == 'b') { angleServomoteur++; print("Angle servomoteur = "); println(angleServomoteur); } else if (key == 'n') { angleServomoteur--; print("Angle servomoteur = "); println(angleServomoteur); } } }
Un nouveau tutoriel pour le robot MRPiZ :
https://fr.macerobotics.com/developpeur/partie-1-tracking-dune-balle-coloree/
Tutoriel sur le lancement d’un script python au démarrage d’une robot MRPiZ.
$ chmod +x script.py
$ sudo nano /etc/rc.local
Exemple pour un script dans le répertoire /home/pi
python /home/pi/script.py &
Fin du tuto !