SimpleBot on Pi3

Where can I find the Python SimpleBot code on the BrickPi3?

Hi @bullerwj,

Unfortunately, we don’t have one for the BrickPi3, but we have one for the older board.

What you could do is to rewrite the program by yourself and then try it out on the BrickPi3. Mechanically, everything should fit like a glove, but we haven’t done it yet.

In case others want to know where is the project for the older BrickPi, here it is:

Thank you!

Actually, I was able to get your project BrowserBot to work so I have base to work from. I do not have a full Mindstorms set (I picked up an 18 lb box of mixed Lego at an antique doll & Toy show and motors & sensors via Bricklink) so it took a while to figure workarounds for the missing parts.

My issue now is not being able to run startx when I remote to the BrickPi3 to run a Scratch script; set up issue? Btw: The Scratch demo on your sight is excellent!

Has anyone rewritten simplebot for the BrickPi3?

When I try the link for the Python Pages I get a 404

here is my revision for BrickPi3

# Program Name: simplebot_simple.py

# ================================

# This code is for moving the simplebot

# Author     Date      Comments
# Karan      04/11/13  Initial Authoring
#
# These files have been made available online through a Creative
Commons Attribution-ShareAlike 3.0  license.
# (http://creativecommons.org/licenses/by-sa/3.0/)

# Revised by T. Cooper 12/18

# --- program updated for Python 3

# --- curses interface added for consistent input mang.

#Commands:

#       w-Move forward

#       a-Move left

#       d-Move right

#       s-Move back

#       x-Stop

# we add these libraries to give us the ability to use sleep func

# use Brick Pi 3 stuff and the curses interface (it makes input easier and consistent)

import time

import brickpi3 #import BrickPi.py file to use BrickPi operations

import curses   # import curses for text processing

# set up curses interface

stdscr = curses.initscr()
curses.noecho()

BP = brickpi3.BrickPi3() # Create an instance of the BrickPi3 class. BP will be the BrickPi3 object.
motorR = BP.PORT_B # right motor
motorL = BP.PORT_C # left motor
speed = 200 # range is -255 to 255, make lower if bot it too fast
#Move Forward

def fwd():
        BP.set_motor_power(motorR,speed)
        BP.set_motor_power(motorL,speed)

#Move Left
def left():
        BP.set_motor_power(motorR, speed)
        BP.set_motor_power(motorL, -speed)

#Move Right
def right():
        BP.set_motor_power(motorR, -speed)
        BP.set_motor_power(motorL, speed)

#Move backward
def back():
        BP.set_motor_power(motorR, -speed)
        BP.set_motor_power(motorL, -speed)

#Stop
def stop():
        BP.set_motor_power(motorR, 0)
        BP.set_motor_power(motorL, 0)

while True:
        inp = stdscr.getkey() #Take input from the terminal
        #Move the bot
        if inp == 'w':
                fwd()
                print("fwd")

        elif inp=='a' :
                left()
                print("left")

        elif inp=='d':
                right()
                print("right")

        elif inp=='s':
                back()
                print("back")

        elif inp=='x':
                stop()

        time.sleep(.01)         # sleep for 10 ms

Hi,

It seems like the path is wrong in that README - if you go to the BrickPi_Python repo, you’ll see that you’re being told to go visit the BrickPi repo instead. So, the simplebot project can be found here:

I’ve also created a PR to address this small problem:

Thank you!