I have come back to programming a little BrickPi. For a while, I’ve kept myself to Scratch, which was fairly easy, but it didn’t have enough functions. Besides, I think Python is more fun, and you can run the RPi Camera Module using a few lines of code.
The tutorial (Step 3, Programming the BrickPi) didn’t really explain it all to well; it just told me to look at some examples. I did that, but I still don’t really get how to run a motor, or get a sensor value.
So I’m asking, is there any tutorial out there explaining the process of programming a BrickPi with Python, or is the only option I have to stick to the example programs and not really understand what’s going on.
Agree the examples show how to do one thing each, but have you checked out the BrickPi Tutorials and the Projects folder on the DI github?
The Simplebot Tutorial has a broken link. I did find a simplebot_simple.py here but I don’t know if the code is for a former version of brickpi or the current version.
The Browser Bot Tutorial is a lot more complicated but it does have a good explanation and valid links to the code. If you don’t understand something in the tutorials - ask here in the forum.
I don’t do BrickPi myself, so hopefully these thoughts will hold you till the DI folks can help you better.
Yeah, I see there are some example projects, they actually do help. It just would be a bit easier if, let’s say for moving a motor, there was a documentation, rather than figuring it out through other programs.
Anyways, the simplebot_simple.py doesn’t work. I tried running it on my current BrickPi 3, the first error I get is ‘No module found/named BrickPi’, an error with the import line.
I guess I’ll have to look into the Browserbot, but that makes everything more complicated as functions are implemented in the code which I won’t use in my case: I just want to run motors, for a start, then make an automatic Bobcat robot that finds something, picks it up, and places it somewhere to go.
Found a BrickPi3 simplebot that claims to work: SimpleBot on Pi3
Yup, that makes sense now, thanks for looking for it.
But I still have a question: is there really no documentation which states all the functions. In example with the simplebot, I mean;
BP.set_motor_power([motor name/port], [speed in digits]) = set the speed of the motor
BP = brickpi3.BrickPi3() ate an instance of BrickPi
Is there something like this?
From what I can tell - you may have the opportunity to create the first “BrickPi3 API Cheat Sheet.”
Only thing close I could find is the brickpi3.py which has what you are are looking for embedded with everything you don’t want to worry about!
I thought I was onto something when I found @graykevinb 's github respository named brickpi3-cheatsheet but, alas, it is a seed waiting to be watered.
(I also found a full “intro to programming a brickpi+ in python” but you need to be from Estonia to understand it, and it doesn’t apply to the BrickPi3…)
Then I’ll be the first creator!
(If I decrypt brickpi3.py).
Let’s hope that works.
We would be thankful if you do!
Hope this will help you…Python Tutorial