Connection of NavX-Micro to Vex Cortex

11 views
Skip to first unread message

MC-FBLinks

unread,
Nov 6, 2017, 1:48:17 PM11/6/17
to navx-mxp
Hi everyone,

It's my first post but I think I'm in the right place.  In addition to competing in FRC, we also have the rookies on our team work in BEST competitions, which means we're restricted to using mostly Vex hardware (in BEST).  Adding the NavX would not be competition legal, but we wanted to give the rookies some exposure to making autonomous routines.

Has anyone ever tried to get a connection between the VexCortex and the NavX-Micro to work?  I imagine that loading the USB drivers would be next to impossible, so that the I2C connection would be the next best bet.  I would appreciate any pointers towards documentation or experience on making it work.  I'm relatively new to both NavX and Vex systems, but quite familiar with I2C/UART/USART/SPI. 

Thanks,
Mike

admin

unread,
Nov 6, 2017, 2:05:17 PM11/6/17
to navx-mxp
Hi Mike,

I'm happy to try to help, I think using navX-Micro in BEST would be interesting.

We've developed I2C implementations for FRC and FTC, so it's definitely possible.

The basic code structure in both cases is an IO thread which executes every 1/user-selected-update rate (typically 50Hz is fine, but the sensor supports up to 200Hz).

Each update period, the sensor performs an I2C burst read transaction w/the navX-Micro.

What language would you use for the code?  For this discussion, I'll assume C++.

The FRC C++ Library source code that acquires data over I2C is here

The code that decodes the register data into meaningful values is here.

This code uses protocol header files found here, which document the various registers as well as provide encode/decode functions.

And the register protocol documentation is here.  This documents the I2C address, and the various registers.

And finally for reference, the FTC C++ Library source code (java) that acquires data over I2C is here.  There's a class called navXIOThread that manages an IO thread somewhat similar to the C++ version above.  One interesting thing here is that FTC doesn't have a PID controller, so this thread can optionally call back to other software (in this case the PID controller) whenever new data is acquired.  Don't know if BEST provides something like that, but if not you might consider this.

I'm here to help and happy to review what you come up with, and would be thrilled to learn more about what Kauai Labs might be able to do to help out students in BEST.

If you'd like, you can email sup...@kauailabs.com if you'd like to discuss things via email.

Cheers,

- scott 

MC-FBLinks

unread,
Nov 6, 2017, 2:29:45 PM11/6/17
to navx-mxp
Scott,

As much as I wish we were using C++/PROS, right now we're using SimuLink/MatLab because they are sponsor/offering an award for using SimuLink.  One of the biggest problems I anticipate is the relatively low spec nature of the Vex Cortex (RAM 64KB, storage is 384KB).

We can start to wrap our own C++ libraries for MatLab, but if you know of anything out of the box, that would be great.

Best,
Mike

admin

unread,
Nov 6, 2017, 2:36:44 PM11/6/17
to navx-mxp
Hmm, not aware of anything for navX-Micro using Simulink/Matlab.  Wrapping the C++ seems like a reasonable approach, though the architecture details aren't really clear to me.

Still, the references I provided should give you everything needed to develop that.

And I'm still happy to support your effort.

 - scott

BTW, you might have noticed the Arduino test jig code, if you want to keep things simple, that might be the best place to start.  You'd need to add register decode for whatever registers you're interested in as shown in the second link from my last email, but perhaps writing the code first on an Arduino before integrating it into the cortex is a useful and simple approach.
Reply all
Reply to author
Forward
0 new messages