Software Update 2: Laying the Foundation
Skip-5.13 GitHub: GitHub - WHS-FRC-3467/Skip-5.13
As of now, we have some tested drive code and the subsystem framework for the double jointed arm and Limelight.
Some issues we ran into early on were needing to make the switch from SDS swerve code to the 364 BaseFalconSwerve library. We had some initial difficulties when trying to test the MK4i code which is still an open issue in the repo. We instead moved to MK4 code and will continue testing on our currently assembled 2022 robot.
364BaseFalconSwerve GitHub: GitHub - Team364/BaseFalconSwerve
Another issue we had was reading the Absolute Value from the REV Through Bore Encoder due to a documentation difference between Rev and WPILib. What we learned we needed to use was the DutyCycleEncoder class with the DIO port of encoder. We also have the Encoder class used and set up in case we need to use it later.
In the constructor:
private DutyCycleEncoder m_upperEncoderAbs = new DutyCycleEncoder(3);
In the initialization function:
m_upperEncoderAbs.setConnectedFrequencyThreshold(976);
m_upperEncoderAbs.setDutyCycleRange(1.0/1025.0, 1.0/1025.0);
Another was adding the proper feedback sensor for the Talon FX. There is no documentation for using a non-CTRE duty cycle encoder with a Talon FX. The documentation for configSelectedFeedbackSensor(FeedbackDevice feedbackDevice) and the FeedbackDevice class are contradictory and the Phoenix docs do not have information about how to setup a sensor that is not connected to the talon or on the CAN bus. The FeedbackDevice class says
//Quadrature encoder
QuadEncoder(0),
//CTRE Mag Encoder in Relative mode or any other device that uses PWM to encode its output
PulseWidthEncodedPosition(8),
//CTR mag encoder configured in absolute, is the same as a PWM sensor.
CTRE_MagEncoder_Absolute(8),
//CTR mag encoder configured in relative, is the same as an quadrature encoder sensor.
CTRE_MagEncoder_Relative(0);

Link to full class: FeedbackDevice (CTRE Phoenix Java 5.30.3)
We will run initial testing with FeedbackDevice.PulseWidthEncodedPosition as that is what makes sense and make changes from there.
The important functions are
In the ArmSubsystem constructor
private TalonFX m_upperJoint = new TalonFX(CanConstants.UPPER_JOINT_MOTOR);
private DutyCycleEncoder m_upperEncoderAbs = new DutyCycleEncoder(DIOConstants.UPPER_ENCODER_ABS);
In the initialization function
m_upperJoint.configSelectedFeedbackSensor(FeedbackDevice.PulseWidthEncodedPosition);
m_upperEncoderAbs.setConnectedFrequencyThreshold(976);
m_upperEncoderAbs.setDutyCycleRange(1.0/1025.0, 1.0/1025.0);In the periodic function
m_upperJoint.setSelectedSensorPosition(getUpperJointPositionAbs(), 0, 10);Methods
public double getUpperJointPositionAbs(){
return m_upperEncoderAbs.getAbsolutePosition();
}
public void setSimplePIDUpper(double position){
m_upperJoint.set(ControlMode.Position, position);
}
public void setMotionMagicUpper(double position){
m_upperJoint.set(ControlMode.MotionMagic, position, DemandType.ArbitraryFeedForward, ArmConstants.kGainsUpperJoint.kF);
}
We have also done some initial testing with the new 2023.0.1 Limelight 2+ firmware and using the vision client found the following results:
- 60 fps at 320x240, ~10ft range
- 20 fps at 640x480, ~20ft range
- 60 fps at 320x240 2x zoom, ~20ft range
We are not sure how these numbers will be over wireless or with FMS bandwidth limits, although of now we will likely use 320x240 2x hardware zoom for Vision Processing and 320x240 for the driver camera. We also set up a subsystem for the Limelight with new properties from the API such as the Camera Transformation function and the April Tag IDs.
We’re looking forward to getting our hands on the prototype Double Jointed arm to begin testing and development this weekend. (edited)