HITechnicCompass implementation

As part of our robot design for this season, we have decided to use a compass to orientate and get an absolute angle for the robot.

We have chose to use the HiTechnic Compass, as we figured (based on this article) that it is supported by WPILib - only to later discover that the relevant classes are not included in this year’s WPILib C++ library.

How can we implement a similar classes and functionality into our project for this year? Is there any other way to use this compass in our code?


The documentation you found was for the 2009-2014 control system, which had a NXT port on the digital sidecar, so you could directly plug the sensor into the control system. The new roboRIO does not have this port, which is why the class was removed.

On the other hand, it is still probably possible to make the sensor work, because digital NXT sensors use the standard I2C protocol, which is supported on the roboRIO. You would have splice your own connection into a NXT cable and port the driver from the old control system (probably not that difficult).

You may also want to consider using a different sensor than a compass to measure orientation because of interference from the magnets in the robot’s motors. You will likely only be able to get an accurate orientation reading when no motors are running on the robot. IMO, a better option is an IMU such as the NavX MXP, or the ADIS16448 (still available in FIRST Choice). I have not yet used either of these, but I have heard a lot of praise for the NavX. The ADIS16448 is new, but it is likely also very good.

NavX MXP no longer functions with the roboRIO. My team purchased a couple to use this year, but the 2016 firmware for the roboRIO breaks it. We have contacted the creators to ask if they are planning on fixing this, but the understanding we have is that no, it will not be updated in the foreseeable future which means it can’t really be used this year…

Please note: this statement is largely inaccurate.

The navX-MXP does work w/the RoboRIO. However, I believe what is being referred to here is that the USB interface between RoboRIO and navX-MXP is not working (it stopped working once the new 2016 RoboRIO firmware was released).

However, the navX-MXP has a total of four electrical interfaces: SPI, I2C, TTL UART as well as USB.

Therefore, the navX-MXP works very well with SPI, I2C and TTL UART w/the 2016 RoboRIO.

King Nerd III, please feel free to contact us directly at [email protected] and we’ll help you get your boards working on one of these three other interfaces.