Git Product home page Git Product logo

brickpi3's Introduction

BrickPi3

The BrickPi3 connects LEGO Mindstorms with the Raspberry Pi. You can learn more about the BrickPi3 here.

BrickPi3 Introduction Header

Documentation

You can find more extensive documentation about setting up the BrickPi3 for the first time, other programming languages contributed by our community, and more extensive information on our projects on the Dexter Industries website here.

Installation

On Raspbian for Robots, run DI Software Update to install or update - this is a more time-consuming option than the alternative instructions seen in the following section.

Quick Install

In order to quickly install the BrickPi3 repository, open up a terminal and type the following command:

curl -kL dexterindustries.com/update_brickpi3 | bash

The same command can be used for updating the BrickPi3 to the latest version.

Compatibility

The following Lego Sensor and Motors are supported by Python and Scratch:

  • Lego Sensors

    • EV3
      • Ultrasonic Sensor
      • Gyro Sensor
      • Color Sensor
      • Touch Sensor
      • Infrared Sensor
    • NXT
      • Ultrasonic Sensor
      • Color Sensor
      • Light Sensor
      • Touch Sensor
  • Lego Motors

    • EV3 Large Motor
    • EV3 Medium Motor
    • NXT Motor

In addition, the BrickPi3 firmware and Python drivers support custom analog and I2C sensors. Most NXT and EV3 aftermarket sensors should work if you add custom python support. See this python example for reading custom analog sensors and this python example for reading custom I2C sensors.

BrickPi3 Introduction Header

License

Please review the LICENSE.md file for license information.

brickpi3's People

Contributors

cleoqc avatar dlech avatar dwalton76 avatar ellerbach avatar gracehuaang avatar graykevinb avatar jhelovuo avatar johnisanerd avatar mattallen37 avatar robertlucian avatar shoban94 avatar skelegorg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brickpi3's Issues

Gyro Sensor on BrickPi3 returns byte instead of short data

BrickPi3, ev3dev, lejos, lego-ev3-gyro sensor, I’m getting odd readings. I was expecting degrees, but instead get 0-255 as I tilt the sensor.

Expected Outcome

From the ev3-gyro-sensor docs, it looks like it should be a signed 16-bit integer:
Which isn’t quite ideal, I can’t tell if it went in a circle, and the resolution isn’t as good as 360 degrees.

My readings over a few seconds, I was rocking it back and forth.
I confirmed this was the same reading from /sys/bus/lego/devices/spi0.1:S4:lego-ev3-gyro/lego-sensor/sensor0/device/lego-sensor/sensor0/value0 so it isn’t an artifact of Java or Kotlin.

and after some research, David L said:

"I've confirmed the problem on the BrickPi3 (firmware v1.4.6). There is a mode on the EV3 Color sensor that uses the same data format and that is working, so I am quite confident this is a BrickPi3 firmware issue. Best thing to do would be to test using Raspbian 4 Robots and if the same problem is there, file an issues with Dexter Industries."

After doing so, Nicole P. suggested I log the issue here.

Impact:

  • I can't access the angle speed measurement, but I can fake it using a delta from the last read - not a blocker.
  • 255 is less granular than 360, but not by much - not a blocker.
  • The biggest issue is "wind-up" - I can't tell if "245" is -10, or +245, without keeping track of the history - annoying, but not a blocker.

Issues with speed control in firmware v1.4.4

I'm using ev3dev and just upgraded to firmware v1.4.4. The voltage compensation introduced in this firmware version seems to cause problems at 9V. I am running off of a variable voltage wall wart power supply. At 12V, motors seem to run normally. At 9V, however, the motor does not rotate.

Here are videos showing the difference. The only difference is the power supply voltage. The commands are the same.

12V: https://youtu.be/Vw6AnY2EMxg
9V: https://youtu.be/EfUtpgdzhdw

Issue with x11-forwarding

When I try to connect to the RaspberryPI with the BrickPI image from you on it, using ssh x.x.x.x -Y, and run scratch, the display won't get forwarded.

I get the error:

...
X11 connection rejected because of wrong authentication
xhost: unable to open display "localhost:10.0"
BrickPi3
X11 connection rejected because of wrong authentication
Unable to access the X Display, is $DISPLAY set properly?
...

After some investigation, we fixed this by editing your scratch-wrapper script in /usr/bin/scratch, by
adding -E parameter to the sudo command when starting click_scratch.py so the environment variables get transfered. So the command will be sudo -E python $SCRATCH_PATH/click_scratch.py.

I did not find this script in this repository, so it might be in another? Can you send me the link and I'll create a pull request

@erickeller

Stacking two brickpi3's?

Hello. I just got two brickpi3's and I have stacked them on top of eachother and given them enough power. How do I control the "stacked" brickpi3 with python script? It seems like I need to go through a complex process of using each individual Brickpi3's ID. I guess I have a second question which is how would I be able to do two Brickpi3's running ev3 dev? I still have yet to figure out how to run a simple motor with a brickpi3 on ev3dev. Any help would be greatly appreciated. You can even send me an email response if you like at [email protected]
Thanks.

LED brigtness of 100

I was noticing while working on ev3dev drivers that only the values 0-99 change the brightness of the LED. If I send a value of 100, the brightness does not change. From the python code, it looks like it is intended that 100 should work.

Error Message from firmware update

Hardware: BrickPi3 + Raspberry Pi Zero W
OS: Raspian Buster Lite

When I am try to update the firmware by executing the shell script brickpi3samd_flash_firmware.sh, there pop up the error message:

    NOT_FOUND_9000c1

I just simply modify the first if paragraph and add these lines after

    elif [ "$RPI_VERSION" == "RPI4" ] ; then
    # use rpi2 interface config file
        INTERFACE_FILE="rpi4.cfg":

    else
        INTERFACE_FILE="rpi1.cfg"

to force using the rpi1.cfg to update the firmware. Hope this method can solve this issue.

Error in brickpi3.py library documentation for set_motor_dps

The documentation for set_motor_dps reads the same as the comments for set_motor_position.
I quote from the documentation.

 |  set_motor_dps(self, port, dps)
 |      Set the motor position in degrees
 |      
 |      Keyword arguments:
 |      port -- The motor port
 |      position -- The target position
 |  
 |  set_motor_position(self, port, position)
 |      Set the motor position in degrees
 |      
 |      Keyword arguments:
 |      port -- The motor port
 |      position -- The target position

As you can see it says they both do the same exact thing.
However functions do two different things. The set_motor_dps function moves the motor by degrees per second. It does not move the motor to a target position.

Why do I need to flash my Raspi with Raspbian for Robots?

I have a Raspi 3B+ and a BrickPi3. I've already setup the ordinary Raspi and have been using it for months - has just the right setup I want for it. To use the BrickPi3 I'll have to erase all that and flash a new OS onto it. Why?
Why can't communicating between the BrickPi3 and Raspi be just a pip install? What changes were made in the ordinary Raspbian?

No Speed Control for set_motor_position

Hello. The set_motor_position() function does not include the option to control the speed of which the motors turn. You can only control the degrees. The BrickPi+ had this feature but apparently it wasn't added to the BrickPi3.

CAD model / PCB layout

Would it be possible for you to export a 3D model of the board or alternatively provide the pcb layout so that it is easier to get the precise connector positioning etc? Thanks!

Motor status indication

While working on ev3dev support for BrickPi3, I found a missing feature that is present on other similar devices. There is not any feedback from the motors other than the position.

Other useful feedback would include:

  • Running - the motor is powered
  • Stalled - the motor is powered, but not rotating
  • Speed - the current speed of the motor
  • Overloaded - when running with the speed pid, the motor is not able to reach the target speed
  • Holding - when running to a position, indicates that the position has been reached and the position pid is holding the motor at the desired position

See ev3dev/ev3dev#282 (comment) for a table with a comparison of other devices.

Regulated Motor Control

If I am corrected the motors are not regulated, meaning if a force is applied the power will increase to keep it moving the same speed. Currently the motors run unregulated, so they will slow down when a force is applied.

Allow selection of stop action when running to position

It would be nice to be able to allow other stop actions when a motor has reached the target position. In ev3dev, we have "hold", which is the current behavior of set_motor_position and also "brake" and "coast".

In some applications, it is desirable to not halt so abruptly.

Custom sensor type does not seem to be working in firmware v1.4.2

In the ev3dev drivers for BrickPi3, we use the custom sensor type for NXT analog sensors. We have successfully updated our drivers to be compatible with the 1.4.x firmware. Everything else seems to be working except for this. Is it possible you missed a change in the firmware when switching from index to bitwise port numbers? I don't see the firmware source code anywhere to check.

Inaccurate readings from get_motor_status for dps

I am getting inaccurate dps readings from get_motor_status.

my code:

import brickpi3
from time import sleep
BP = brickpi3.BrickPi3()

BP.set_motor_dps(BP.PORT_B, 200)
for i in range(0, 20):
print(BP.get_motor_status(BP.PORT_B))
sleep(0.2)
BP.set_motor_dps(BP.PORT_B, 0)
Running that code I got readings anywhere from 50 to 200 dps off depending on what dps I set it to.

Initial power out of allowed range

Reference issue

If the system is switched on, the default motor power is set to -128. As this is out of the allowed range of -100 <= ... <= 100, setting the power to 0 causes a hop backwards.

I have tried to set the motors power limit to 0 first, yet it didn't have an effect.

After looking at the source code, I believe that this is hardware related (maybe with the attached powerbank?). What could be the reason for such a problem?

brickpi3.reset_all() sometimes fails to stop motors.

And yet another bug! Once in a while BP.reset_all() doesn't correctly reset everything. For example I'll be running two motors and do CTRL-C to terminate the program. As you can see in the code that it should run BP.reset_all(), which it does. However sometimes it will not stop the motors at all or even stop one motor but not the other.

try:
main()
except Exception as Inst:
print(Inst)
except KeyboardInterrupt:
pass
BP.reset_all()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.