Using Arduino with RoboRIO

Hi,

We are trying to using Arduino with the roboRIO in c++. We are calculating position of the robot using three sensors (2 encoders and a NavX-mxp sensor) using Arduino. We then want to connect Arduino to the roboRIO so we can read the robot’s position from LabView. Also, we are communicating with the roboRIO via wifi. We would appreciate it if you can help us!

Is there a reason you’re running the NavX off an Arduino? It plugs directly into the RIO.

We didn’t have a ton of experience with LabView, so we thought it would be easier to do everything using Arduino and just send the value of position to the roboRIO

I don’t have much experience with Labview either, but I’m pretty sure you should use the third party library LabVIEW Trajectory Library (and more) WPILib port V1.4 - NI LabVIEW - Chief Delphi

1 Like

I recommend plugging the NavX into the roborio. Here is the library and guide on how to use

For encoders, you can plug into DIO pins, plug them into a Talon SRX, or plug them into a CANifier

And a guide:

CTRE has very good documentation on how to use their stuff. Communicating with an Arduino is not exactly trivial. There are many ways to do it, including I2C, using digital IO, SPI, but there are pros and cons for each.

In addition to the library, there is a separate download containing utilities and sample projects. It includes several sample robot projects that use the trajectory library. (Note - That sample5, which is a swerve drive, works, but is still a work in progress. Specifically, there are issues with reverse trajectory execution.)

To answer the original post, if you want to go that direction: the arduino Wire library allows you to communicate via i2c, which you could use to talk to the rio. You could also use Serial library via the rs-232 rio port, or the SPI library in the spi port.

There are a lot of online LabVIEW tutorials. Here is a link to one. Secret Book of FRC LabVIEW (and control logic) version 2.07 - Programming - Chief Delphi