Je vous informe que l’entreprise Mace Robotics sera présent le samedi 30 avril à la première rencontre Nationales Raspberry Pi à Nevers.
Information : http://adn.agglo-nevers.net/index.php/rendez-vous/1-premieres-rencontre-nationales-raspberry-pi
Je vous informe que l’entreprise Mace Robotics sera présent le samedi 30 avril à la première rencontre Nationales Raspberry Pi à Nevers.
Information : http://adn.agglo-nevers.net/index.php/rendez-vous/1-premieres-rencontre-nationales-raspberry-pi
Nouvelle vidéo, une course de deux robots MRPi1 complétement autonome :
Les deux robots sont programmés pour suivre le chemin tous en évitant les obstacles. Le robot MRPi1 version Raspberry Pi est programmer en langage Python et la version arduino en langage arduino.
Voici le programme en langage Python pour le MRPi1 Raspberry Pi :
# importez la librairie du robot MRPi1 from mrpi1_lib import * import time # initialisation de la vitesse speedFast=50 speedSlow=30 # seuil détection obstacle limit_obs = 300 try: while 1: # lecture des capteurs de proximité prox1 = proxSensor(1) prox2 = proxSensor(2) prox3 = proxSensor(3) prox4 = proxSensor(4) prox5 = proxSensor(5) prox6 = proxSensor(6) # si obstacle présent sur tous les capteurs if prox1>limit_obs and prox2>limit_obs and prox3>limit_obs and prox4>limit_obs and prox5>limit_obs and prox6>limit_obs: # tourner à droite turnRight(speedSlow) elif prox4>limit_obs or prox5>limit_obs or prox6>limit_obs: # si obstacle à droite, tourner à gauche turnLeft(speedSlow) elif prox1>limit_obs or prox2>limit_obs or prox3>limit_obs: # si obstacle à gauche, tourner à droite turnRight(speedSlow) else: # sinon avancer forward(speedFast) time.sleep(0.4) except: stop() exit()
Le programme en langage arduino pour le MRPi1 version Arduino :
// librairies du robot MRPi1
#include <mrpi1_arduino.h>
// variables pour les capteurs de proximité
int prox1;
int prox2;
int prox3;
int prox4;
int prox5;
int prox6;
// initialisation de la vitesse
int speed = 60;
// initialisation de seuil des obstacles
int limit_obs = 300;
void setup()
{
// initialisation du port série
Serial.begin(115200);
}
void loop()
{
// lecture des capteurs de proximité
prox1 = proxSensor(1);
prox2 = proxSensor(2);
prox3 = proxSensor(3);
prox4 = proxSensor(4);
prox5 = proxSensor(5);
prox6 = proxSensor(6);
// Si obstacles présent sur tous les capteurs
if((prox1 > limit_obs) and (prox2 > limit_obs)and (prox3 > limit_obs) and (prox4 > limit_obs) and (prox5 > limit_obs) and (prox6 > limit_obs))
{
// reculer
back(speed);
}
else
{
// si obstacle à gauche
if((prox1 > limit_obs) and (prox2 > limit_obs))
{
// tourner à droite
turnRight(speed);
}
else
{
// si obstacle à droite
if((prox6 > limit_obs) or (prox5 > limit_obs) or (prox4 > limit_obs))
{
// tourner à gauche
turnLeft(speed);
}
else
{
// si obstacle à gauche
if((prox1 > limit_obs) or (prox2 > limit_obs) or (prox3 > limit_obs))
{
// tourner à droite
turnRight(speed);
}
else
{
// sinon avancer
forward(speed);
}
}
}
}
}
http://fr.macerobotics.com/developpeur/tutoriels/gestion-des-leds-version-arduino/
New video of MRPi1 robot :
The python program :
from mrpi1_lib import *
import time
ir = 0;
state = 0
controlEnable()
while 1:
# read the infrared receiver
ir = irReceiver()
time.sleep(0.2)
if(ir == 1) and (state == 0):
forwardC(10,400)
state = 1
if(ir == 2) and (state == 0):
forwardC(10,800)
state = 2
if(ir == 3) and (state == 0):
forwardC(10,1600)
state = 3
if(ir == 3) and (state == 1):
forwardC(10,1200)
state = 3
if(ir == 3) and (state == 2):
forwardC(10,800)
state = 3
if(ir == 2) and (state == 1):
forwardC(10,400)
state = 2
if(ir == 1) and (state == 2):
backC(10,400)
state = 1
if(ir == 1) and (state == 3):
backC(10,1200)
state = 1
if(ir == 2) and (state == 3):
backC(10,800)
state = 2
if(ir == 0) and (state == 3):
backC(10,1600)
state = 0
if(ir == 0) and (state == 2):
backC(10,800)
state = 0
if(ir == 0) and (state == 1):
backC(10,400)
state = 0
La plateforme MRPi1 avec une carte Arduino Uno :
Voici une petite vidéo du robot contrôlé par l’Arduino :
Le programme réalise sous l’IDE arduino :
// initialisation des variables
int prox_1;
int prox_2;
int prox_3;
int prox_4;
int prox_5;
int prox_6;
int speed = 60;
void setup()
{
// initialisation du port série
Serial.begin(115200);
// Allumer les 3 leds du robot
led(1,1);
led(2,1);
led(3,1);
}
void loop()
{
// Lectures des capteurs de proximité
prox_1 = proxSensor(1);
prox_2 = proxSensor(2);
prox_3 = proxSensor(3);
prox_4 = proxSensor(4);
prox_5 = proxSensor(5);
prox_6 = proxSensor(6);
// Si obstacle à gauche
if(( prox_1 > 500) or (prox_2 > 500))
{
// tourner à droite
turnRight(speed);
}
// Si obstacle à droite
if(( prox_6 > 500) or ( prox_5 > 500))
{
// tourner à gauche
turnLeft(speed);
}
// Si obstacle devant
if(( prox_3 > 500) or ( prox_4 > 500))
{
// tourner à gauche
turnLeft(speed);
}
// si pas d'obstacle
if((prox_1 < 500) and (prox_2 < 500) and (prox_3 < 500) and (prox_4 < 500) and (prox_5 < 500) and (prox_6 < 500))
{
// avancer
forward(speed);
}
}
The python program :
from mrpi1_lib import * import time #main program state = 1 try: # infinite loop while 1: if state == 2: play("Thank you bye")# speech synthetis state = 3 # read sensors p3 = proxSensor(3) p4 = proxSensor(4) forward(30) print "%d %d" %(p3, p4) if (p3 > 900 or p4 > 900): stop() # stop robot state = 2 playWav("BeCarefull.wav") # play wav file except: stop() exit()
Voici, l’architecture logicielle du microcontrôleur STM32F407 du robot MRPi1 :
The python program :
from mrpi1_lib import *
import time
# activer le controle
controlEnable()
# avancer de 30 cm
forwardC(15, 1200)
# boucle infini
while 1:
# lecture capteur de proximité 3
p = proxSensor(3)
# pause de 0.5 seconde
time.sleep(0.5)
# si capteur > 300
if p > 300:
backC(15,1200) #reculer de 30 cm
exit()
La campagne participative est en ligne : http://campaign.macerobotics.com/
Cette campagne va permettre de pouvoir lancer la première production de série du robot MRPi1.