[SOLVED] BricKuber doesn't control motors via BrickPi3

I recently took delivery of a BrickPi3 which I intend to use with a RPi 3B running Raspbian Stretch and BricKuber.

As a simple test, before building the full BricKuber robot, I connected motors to MA & MB and a V1 camera to the camera port on the Pi. Before running the BricKuber.py script, I ran raspistill to confirm that the camera was working which it was.

When I run BricKuber.py the motor connected to MB runs continuously and the software appears to go into a loop. Stopping the script with CTRL-C doesn’t stop the motor from running. Only a power cycle does that.

If I run with -v the last message refers to brickuber_lib.py line 86 self.home_all()

I can’t build the whole robot yet as my wife has confiscated the Lego mindstorm kit to wrapped it up for Christmas!!! However I still have the two motors to play with…

Part of the home_all() function is to run motor B at low power until it physically hits it’s mechanical limit. At that point, when the program detects that the motor is no longer running, it resets the encoder (thus calibrating or “homing”). The program won’t continue until this step is complete.

Regarding the motor not stopping when you press CTRL+C, that is because the try and except KeyboardInterrupt is not around the BricKuberLib init (the instantiation in BricKuber.py, on line 38). If you move line 38 to inside the try, it should stop (float) the motors when you press CTRL+C.

To me it sounds like it’s working perfectly, you just need to attach the motors and BrickPi3 to the physical robot :slight_smile:

1 Like

@Matt
Many thanks for the response. I ran the code again and artificially stopped the motor attached to MB. The motor reversed briefly and then the code produced a message about taking pictures of each face before exiting with an error message about list index being out of range which I guess is because the camera isn’t pointing at a real Rubik’s cube.

Can’t wait for Santa to deliver the Lego set. :slight_smile:

Thanks again for your prompt help.

Cheers

Chris

1 Like

This topic was automatically closed after 32 hours. New replies are no longer allowed.