Skip to content

Latest commit

 

History

History
208 lines (135 loc) · 8.65 KB

File metadata and controls

208 lines (135 loc) · 8.65 KB

A301

Software Resources

API

The A301 API is available through REVLib and will later be available natively through WPILib in the near future.

REVLib should be available in the vendor dependencies of WPILib VS Code, but you can also use this JSON URL directly:

https://software-metadata.revrobotics.com/REVLib-2027.json

Offline Install

Refer to WPILib Docs about installing 3rd party libraries, and see REV.md for the full REVLib changelog.

Important

REVLib 2027.0.0-alpha-7 requires WPILib Alpha 7

Important

A301 firmware v27.0.0-prerelease.15 introduces a breaking change to the A301 CAN protocol. REVLib v2027.0.0-alpha-4 or later requires firmware v27.0.0-prerelease.15 or later, and firmware v27.0.0-prerelease.15 or later requires REVLib v2027.0.0-alpha-4 or later — you must update both together.

Hardware Client 2

REV Hardware Client 2 (RHC2) is used to update and test the A301.

RHC2 for Desktop - This can be used to install RHC2 to a connected Systemcore. After installing, you will be able to connect your local desktop client to the Systemcore's RHC2. Alternatively, access the Systemcore's RHC2 webpage from its homepage.

rhc2 systemcore install

Alternatively, the RHC2 IPK for Systemcore can be installed by clicking "Add Package" on the home screen of Systemcore and selecting this file.

See REV.md for the full RHC2 changelog.

Firmware

Caution

Update RHC2 to 1.2.1 or later before updating the A301 to v27.0.0-prerelease.15 or later. Newer versions of RHC2 handles breaking changes introduced in prerelease.15; older versions of RHC2 do not, and performing the update with an older RHC2 can leave the A301's firmware in a bad state.

If this happens, it is recoverable, but not a good time: update to the latest version of RHC2, then force a bootloader update by enabling the checkbox in the "Advanced" section of the update manager and re-running the update.

The recommended method to update the A301 firmware is through REV Hardware Client 2 running directly on Systemcore. Since Systemcore will likely not be connected to internet, it is recommended to use the RHC2 on desktop connected to Systemcore. This will allow you to get the latest firmware updates:

1. Getting the firmware

You must add the A301 alpha channel to get the latest A301 updates by pasting the following code into RHC2:

a301-alpha

rhc2 a301 add channel

After adding the code, download the latest A301 firmware.

rhc2 a301 download

2. Installing the firmware

With network access to the Systemcore (via ethernet, wifi, or usb-c) that also has RHC2 installed, you can connect to it from your desktop client. This will give you the same experience as accessing it through the browser with the benefit of having the latest firmware.

rhc2 systemcore connect

Install the devices.

rhc2 a301 update

Alternate direct firmware upload

Alternatively, you can install firmware without the desktop client by uploading the firmware file directly to RHC2 on Systemcore.

A301 update on systemcore

Direct firmware download for updating via Systemcore:

Older downloads (not compatible with REVLib 2027.0.0-alpha-4 or later)
A301 Firmware Changelog

2027.0.0-prerelease.17

  • Support for motor inversion setting
  • Individual status frame period configuration messages
  • Firmware survives voltage drops under 6v

2027.0.0-prerelease.16

  • Custom absolute position range offset
  • Smoother hall speed estimation
  • Applied output is correct on stopped motor

2027.0.0-prerelease.15

  • New A301 protocol
  • Fix for deceleration asymmetry in voltage mode
  • Enabled configurable status periods
  • Settings save automatically
  • Faster eeprom saving
  • Better rotor estimation during stall
  • Added gearbox and motor life handlers
  • Added user velocity limit during position control
  • Added support for MRC override to run without a driver station

2027.0.0-prerelease.14

  • Fixes sensor faults not detected in voltage modes
  • Fixes false failed gearbox detection

2027.0.0-prerelease.12

  • Fixes status periods
  • Improves voltage control
  • Replaces output current on status0 with improved average motor current
  • Improves applied output reporting

2027.0.0-prerelease.11

Initial release for A301

Getting Started

Full code docs for the A301 API can be found here: Java, C++

You can create an A301 object by doing the following:

// Create an A301 object on Motioncore channel 0. The A301's CAN ID will be autodetected.
A301 motor = new A301(CANBusMap.CAN_D0);

// Create an A301 object on Motioncore channel 0, with a specific CAN ID of 5.
A301 motor = new A301(CANBusMap.CAN_D0, 5);

Note

It is recommended to use the CANBusMap rather than a raw integer as Motioncore D0 is not the same as '0' (which is on Systemcore). We will look into ways to remove this potential error as we iterate on the A301 API.

To drive the motor, there are individual methods for the different control types:

// Command the motor to a velocity in RPM
motor.setVelocity(100);

// Command the motor to a relative position (multiple rotations)
motor.setPosition(5);

// Command the motor to an absolute position (single rotation)
motor.disableAbsolutePositionContinuousInput(); // Once called, this setting will be saved to the motor
motor.setAbsolutePosition(0.4);

// Command the motor to an absolute position with continuous input (shortest path)
motor.enableAbsolutePositionContinuousInput(); // Once called, this setting will be saved to the motor
motor.setAbsolutePosition(-0.4);

// Command the motor to a position with a speed constraint in RPM
motor.setPosition(5, 50);
motor.setAbsolutePosition(0.4, 50);

// Command the motor to a specific throttle level 
motor.setThrottle(0.5);

The A301 class offers getters to retrieve the status of the device. These will return a Signal object which includes the value and additional information about its validity:

// Get the relative position of the encoder
SmartDashboard.putNumber("position", motor.getRelativeEncoderPosition().get());

// Get the input voltage of the motor
SmartDashboard.putNumber("voltage", motor.getBusVoltage().get());

// Check if the received value is valid before using it
Signal<Double> velocity = motor.getEncoderVelocity();
if (velocity.isValid()) {
    odometry.update(velocity.get());
}

You can configure the absolute encoder's output range from the default [-0.5, 0.5) to anywhere between (-1, 0] and [0, 1), always with a size of 1 rotation. Use the absolute encoder range offset configuration.:

// Set the range to [0, 1)
motor.setAbsoluteEncoderRangeOffset(0.5);

// Set the range to [-0.1, 0.9)
motor.setAbsoluteEncoderRangeOffset(0.4);

// Set the range to [-0.5, 0.5) (default)
motor.setAbsoluteEncoderRangeOffset(0);