Home » BLOG » MRPi1 – delivery robot

MRPi1 – delivery robot

New video of MRPi1 robot :

  • Python program,
  • Autonomous robot,
  • Control the position with remote control,

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

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *