So, my first experiences with BrickPi have been a bit less than ideal. The NodeJS library doesn’t work, most of them are incomplete in terms of sensor support, and all of them are inconsistently implelmented. I’ve looked at the source code for many of the language bindings, and it just seems like software to support this product is an afterthought.
So far, the NXT RGB sensor doesn’t seem to work in either the NodeJS or Python implementations.
I would be happy to clean up the Nodejs language implementation, but there is apparently no documentation of the serial protocol to communicate b/n the Pi and the BrickPi, nor documentation of the sensor-specific data structures.
Hey @rick.bullotta , thanks for your patience. I’m assuming you’re referring to this library here.. This was graciously donated to us by a community member; none of us really have any expertise in NodeJS, but we were grateful for the contribution.
I apologize if our documentation of the software/firmware communication is incomplete. It’s been on our development list for some time and we’ve been working behind the scenes the last few months to improve it. Not an excuse, as we would really like to continue to improve our software.
I can offer two things immediately. We have one other “Dexpert” who loves NodeJS and I can ask him to take a look and see if he can help update things.
It sounds like you’re interested and capable though of working on the NodeJS library and have some background with it. If that’s the case, on Monday can I put you in touch with our engineer Matt? He might not be able to provide precise documentation, but he might be able to help walk you through the soft spots, and answer any questions. It also might be helpful for him to have this conversation, and figure out what looks soft from the outside.
Again, I apologize for the slow response here, and we’re grateful for your willingness to help us cleanup the code.
Hi, John/Matt. I spent the weekend comparing the various implementations and I was able to fix some of the bugs in the Nodejs libraries. I also added some new capabilities to them in the process, and updated some of the dependencies/packages that they utilize to more recent versions. I still can’t get the NXT color sensor working, but it doesn’t seem to work in any of the implementations (is it supported for BrickPi?).
In any case, I have the necessary code changes ready to go if you want to take a look.
Hey Rick, I saw the PR’s go through to the other repo, and I saw that they were accepted. Thank you so much for taking the time to update them for everyone else, we really appreciate the effort, it’s amazing!
Happy to help. Probably worth having another set of eyes take a look to make sure I didn’t introduce any new issues! Also, I wasn’t able to fix the issue with the NXT RGB color sensor - I really don’t know how it works, and it doesn’t appear to be as simple as I2C communications.
I’d also like to talk with you or Matt about the motor encoder readings. I was under the impression that the Lego encoders had a resolution of 360 but I’m getting some odd numbers. Also, the PID function seems to be stopping the motor a bit short.
Great Rick, I know Matt is following this topic right now, I’ll also followup by e-mail. The RGB color sensor is indeed it’s own protocol between the sensor and the BrickPi, but it should be accessible through the serial lines to the Pi.
OK. Happy to help diagnose what’s up. Also want to do a deeper dive into the motor API and clean that up/simplify it a bit. Something seems wrong with the encoder values I’m seeing.
Hi Rick, there have been some recent updates to the BrickPi Python drivers. If you haven’t already done so recently, I recommend that you run the “DI Software Update” on the desktop of Raspbian for Robots to be sure that your drivers are up to date.
The Lego motors do indeed have a resolution of 1 degree (360 per rotation). Prior to the recent drivers update, the values read were relatively unreliable.
The communication between the Raspberry Pi and BrickPi is documented in the firmware source files. The communication header is documented here and the communication data is documented here.
FYI, with the latest Python code, the motors are still misbehaving. How can I update any other drivers given that I’m not using the Raspian for Robots distro?
how is it going here guys? I just bought the BrickPi3 as it seemed it has nodeJS support only to find that the libraries don’t work. NOW I saw this topic which says it’s not really supported, but it was 2 years ago
Read the BrickPi3 page It says the languages it supports and NodeJs is not supported. Yes it did say that for the BrickPi+ but not for the BrickPi3. Yes there is a way to make it work, maybe. You need to research if you can use the spice communication protocol with nodejs. Spice is the way the rpi and BrickPi3 communicate, where the BrickPi+ used I2C. So if you can find a way to use spice all you have to do is see what spice commands are sent from the BrickPi3.py module and implement them into nodejs. If that doesn’t work you could look into communicating to python with nodejs. Basically nodejs would run a python command which would then communicate with the BrickPi3. It’s possible but not out of the box.
May I suggest just using python? Its pretty much the standard for the RPi so you’ll get a lot more support. NodeJs just isn’t that popular on the pi.
EDIT
I made a mistake, t BrickPi+ uses serial to communicate. Sorry if I caused any misunderstandings.
Thanks for the clarification. The “BrickPi3 Page” you linked to is a google search.
nodeJS was mentioned as a supported language for BrickPi - BrickPi3 did not had new pages when I ordered so… bad luck for me but I did read everything on here.
I’ll try to make it work myself now.
I can’t find anything called Spice. In your linked Python script you use “SPI” - which makes more sense.So is SPI communication the thing to rebuild in node or am I missing the “Spice” thing? Do you mind linking me to it?