WPILib on a PI + Romi?

Also, the programs (working versions) demonstrated during the Hour of Code webcast are now online and links are here:

One of the projects is to drive the robot around a fixed pattern, smaller version of this:

http://cmra.rec.ri.cmu.edu/products/teachingmindstorms/movement/documents/Movement_designspecifications.pdf

and the other is for a small tabletop sized FRC robot (with a roboRIO) that tracks to a vision target using a Raspberry Pi and web camera. It then deposits an object being carried by the robot arm.

Both programs are good examples of robot programs using the Command and Subsystem classes.

Enjoy
Brad

6 Likes

How much memory is required on the Pi 4 to get the vision working with the webcam? They sell 2/4/8 GB versions. I ordered the Romi - now looking to snag a cheap Pi. Thanks.

It doesn’t take much memory to do vision processing, you’ll be fine with 2 GB of RAM for Romi use.

3 Likes

I have a 2GB Pi 4 and it worked. I wasn’t doing intense processing so am not sure the frame / processing rate.

2 Likes

At the risk of creating a buying frenzy, I notice that the Pololu Balboa robot kit has the same basic electronics (including the encoders and IMU) in a different form factor. It is a bit more expensive, and intended to be built as a self-balancing robot, but you can add a caster and run it as a conventional 2-wheel-drive platform.

I have a couple on order to test. I suspect that this platform could be used as a substitute, with appropriate changes to the encoder calibration.

Please note that I have no connection to the WPILib project, or Pololu, so take this advice with a grain of salt.

Re buying frenzy, it would actually help if people went ahead and placed backorders for the FIRST Romi kits to help Pololu better judge demand. I don’t have anything official, but my sense is their lead time is only 3-4 weeks.

7 Likes

Pololu is having a sale, and the Balboa as well as Romi accessories are included. look at the specials page for details. I do not work for Pololu, but do enjoy this project :).

1 Like

Just to follow up, I received the Balboas yesterday, and they do seem to work - with a few caveats.

The electronics are essentially identical. It is the same processor running at the same voltage and clock rate. All GPIO pin assignments and I2C addresses are the same for all of the integrated sensors.

The Beta 4 WPILibPi image was able to flash firmware onto the Balboa controller, and I was able to drive the platform around using the Romi Reference sample project.

The Balboa doesn’t have the same 3-rail header area for the spare GPIO pins, so wiring up other peripherals will be different. And it is not possible to gear the motors for the same encoder resolution as the Romi, but you can get pretty close. Also, the caster kit doesn’t set the controller parallel to the ground, so there could be some differences in how the IMU behaves on this platform.

Best bet is to get actual Romis to use, or just run WPILibPi on a bare Raspberry Pi with no robot. But if you did need to drive around and you can’t wait a couple weeks for a Romi, the Balboa can be made to work.

EDIT: If you do buy a Balboa, don’t forget to order motors and wheels. (I used the 50:1 motors.) It also does not include the 2x20 female header or standoffs for mounting the Pi.

1 Like

Good to know that the Romi firmware works in the balboa (at least for driving)! The 5 GPIO channels on the Romi correspond to specific Arduino pin numbers (see Getting to know your Romi — FIRST Robotics Competition documentation - basically pins 11, 4, A2-A4) so if you feel like soldering some pin headers to those ports, you might be able to configure them for use via the web UI

1 Like

True. Unfortunately, the Balboa doesn’t expose D4 or D11 at the edge of the board. They are only exposed (AFAICT) from the LCD connector, which is underneath where the Pi would mount. The analog pins are available at the card edge.

So it would be inconvenient to wire to D4 and D11, and you don’t get those nifty Vcc and GND rails like you do on the Romi. But it could be done.

1 Like

Could you use a right angle header and a ribbon cable to a small breakout board (possibly made with perfboard or the like)? That way you could make the rails and still have control over the input and output. Is there space for such things?

1 Like

The Balboas I received already have a low-profile female header installed, so there isn’t much room above that for monkey business.

I have been looking at the Romi firmware GitHub - wpilibsuite/wpilib-ws-robot-romi and I think it would be easier to just remap D4 and D11 onto pins that are available at the edge of the PCB.

The code change would be trivial, thanks to the clean coding they did.

EDIT to add: I’d had the same thought about cutting a small piece of perfboard. I’m still too busy playing with the basic robots to have gotten very far adding peripherals.

2 Likes

I get that. Perhaps that is where I should focus, but we have kits with peripherals already in the hands of our members, so I wanted to learn to use the Romi in all their capacities so I can better guide the members as they learn. So, once I fgured out how to do much of the basics with the base itself, onto peripherals I moved.

This system is incredibly well-done especially the WPI Lib implementation.

2 Likes

Believe me, I will be playing with sensors soon. Just haven’t gotten that far yet. I have the robot arm kit, but haven’t built it yet partly after reading your experiences needing to add an external voltage regulator.

I am thinking about using one of these: Pololu - 5V, 3.2A Step-Down Voltage Regulator D36V28F5 to condition power for the five I/O ports on the Romi. Is this what you used? Can you share some details about what you did to run the arm?

EDIT: Link to correct Pololu part.

You probably want the 5V version of that regulator. I (finally) unboxed and put together the Romi Arm yesterday and ended up going with one of these (UBEC DC/DC Step-Down (Buck) Converter - 5V @ 3A output ID: 1385 - $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits) that I had lying around. Works nicely! The input end of the regulator is connected via the VSW power rail, which is controlled by the power switch (this way, the regulator won’t draw power if the switch is off)

2 Likes

Thanks! That was the part I meant to link. I was looking at it on a local supplier’s site, but messed up when I went looking for a legit Pololu link.

Pololu also sells a standalone regulator version of the one they use in the control board. Pololu 5V, 2.5A Step-Down Voltage Regulator D24V22F5
I am currently using a huge converter I had for another project. it is way overkill for this, but it did help me sort some things out. For price only, I am going to try these from Amazon. If they work, great, if they are too sketchy, I will go with either the Pololu or the Adafruit one @zeequeue mentioned.

I followed the directions for assembly, but rather than using their PWM values (I think 2400 is out of range for WPILib), I zeroed them with the robot on but no values being written. The jaw I left at halfway for the default which allows us to open or close it. That was the piece I was most concerned about breaking when saturated.

1 Like

We use the arduino Servo library, and convert all the incoming PWM signals to a [0, 180] angle, which we then pass into the Servo write method. This maps [0, 180] (degrees) to [544, 2400] (microseconds).

1 Like

So, I actually started a new thread over here because I was also looking for over-current protection. @nuttle recommended this, but It seems that the board you posted has it too. The one they use on the board that I linked earlier seems to have heat protection, but not over-current protection.

I thought there was something magical going on :).

My backorder shipped yesterday, so I’m not going to worry about trying to rework the image to work with the Pi Bridge & discrete power board.