Robotpy-navx updated for 2020

Wheels available for Windows (unfortunately they don’t have good simulation support yet) and for roborio via the robotpy-installer. Docs still need to be updated. For the roborio:

python -m robotpy_installer download-opkg navx
python -m robotpy_installer install-opkg navx

Try it out and let me know how it works!

1 Like

2020.0.2 uses NavX 3.1.403, which now supports desktop simulation! Additionally, we now push OSX wheels for robotpy-navx.

2020.2.1 is out!

2020.2.2 is out!

1 Like

I wonder if I am doing something wrong with the Navx.
I do have version 2020.2.2 of the Navx libraries installed.
You can see the output I get below. When I change the values manually, it shows up in the driver station. However, they do not change when the robot spins in a circle. Here is our code.

#!/usr/bin/env python3
    This is a demo program showing how to use Mecanum control with the

import wpilib
from import MecanumDrive
from networktables import NetworkTables

# Import Rev Hardware for Can
import rev
# Import NavX
import navx

def run():
    raise ValueError()

class MyRobot(wpilib.TimedRobot):
    # Channels on the roboRIO that the motor controllers are plugged in to
    frontLeftChannel = 2
    rearLeftChannel = 3
    frontRightChannel = 1
    rearRightChannel = 0

    # The channel on the driver station that the joystick is connected to
    joystickChannel = 0

    def robotInit(self):

        """Robot initialization function.  The Low level is to use the brushless function on the controllers.""" = NetworkTables.getTable("SmartDashboard")

        self.timer = wpilib.Timer()

        # Communicate w/navX MXP via the MXP SPI Bus.
        # - Alternatively, use the i2c bus.
        # See for details

        self.navx = navx.AHRS.create_spi()
        # self.navx = navx.AHRS.create_i2c()

        if wpilib.RobotBase.isSimulation():
            self.frontLeftMotor = wpilib.Jaguar(self.frontLeftChannel)
            self.rearLeftMotor = wpilib.Jaguar(self.rearLeftChannel)
            self.frontRightMotor = wpilib.Jaguar(self.frontRightChannel)
            self.rearRightMotor = wpilib.Jaguar(self.rearRightChannel)

            self.frontLeftMotor = rev.CANSparkMax(
                self.frontLeftChannel, rev.CANSparkMaxLowLevel.MotorType.kBrushless
            self.rearLeftMotor = rev.CANSparkMax(
                self.rearLeftChannel, rev.CANSparkMaxLowLevel.MotorType.kBrushless
            self.frontRightMotor = rev.CANSparkMax(
                self.frontRightChannel, rev.CANSparkMaxLowLevel.MotorType.kBrushless
            self.rearRightMotor = rev.CANSparkMax(
                self.rearRightChannel, rev.CANSparkMaxLowLevel.MotorType.kBrushless

        # invert the left side motors

        # you may need to change or remove this to match your robot
        self.rearLeftMotor.setInverted(False) = MecanumDrive(

        self.stick = wpilib.XboxController(self.joystickChannel)

    def robotPeriodic(self):"Entered disabled mode")


        if self.timer.hasPeriodPassed(0.5):
  "Displacement X", self.navx.getDisplacementX())
  "Displacement Y", self.navx.getDisplacementY())
  "IsCalibrating", self.navx.isCalibrating())
  "IsConnected", self.navx.isConnected())
  "Angle", self.navx.getAngle())
  "Pitch", self.navx.getPitch())
  "Yaw", self.navx.getYaw())
  "Roll", self.navx.getRoll())

    def autonomousInit(self):
        """Runs Once during auto"""
        # self.counter = 0

    def autonomousPeriodic(self):
        """Runs Periodically during auto""""Timestamp", self.navx.getLastSensorTimestamp()), 0.5, 0, 0)

if __name__ == "__main__":


That’s correct, there’s no automatic gyro support, you would need to set it manually.

I’ve updated the navx examples in, but they require pyfrc changes to work. I’ll be working on finishing these up this afternoon.

1 Like

Thank you. I do not mean to push. I was just wondering if I was missing something.