team973 / 2023-inseason Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Based on a gamepiece preload variable, set the candle to the color to indicate the selected preload in disabled. Integrates with GreyDash.
Our arm will be on the CANivore, so we will take advantage of our Phoenix Pro license
To get the official april tags ready for the field
We need to create the 2023-inseason repository for our code
git clone
Create the function getWristAngle
that should return the current wrist angle in degrees.
Use m_writstMotor.getRotorPosition
to get the current position of the wrist motor in rotations and use the wrist gear ratio to convert to a wrist position in degrees. Use a rotation2d
object to convert from rotations to degrees. Rotation2d.fromRotations(rot).getDegrees
.
We need an indicator that something bad happened and we need to check our exception log. Flash the CANdle red in disabled
Test Claw and get manual control working.
Rename some member varaibles to make the code more clear
m_clawMotor
to m_intakeMotor
m_clawMotorOutput
to m_intakeMotorOutput
ClawState
to IntakeState
m_clawState
to m_intakeState
ClawInfo.FX_ID
to ClawInfo.INTAKE_FX_ID
Give values to CAN IDs that make sense.
We want to select whether we have preloaded a cone or cube with GreyDash. The UI logic is there, but we need to implement this in our Java client
Add a motor for controlling the wrist
m_wristMotor
com.ctre.phoenixpro.hardware.TalonFX
m_intakeMotor
...
m_wristMotor.getConfigurator().apply(motorConfig);
getclawCurrentAngle
to getWristCurrentAngle
getWristCurrentAngle
to use m_wristMotor
, not m_intakeMotor
setClawTargetAngle
to setWristTargetAngle
Add a compressor object in Robot.java so we can build pressure
compressor-init
git checkout main # Go to the main branch
git pull main # make sure it is updated
git checkout -b compressor-init # create the new branch
CTREPCM
compressor in RobotInit. The variable should be visible to the whole class, private, and finalAdd this to the shared folder: https://github.com/LimelightVision/limelightlib-wpijava/blob/main/LimelightHelpers.java
Update the Intake to match CAD
GreyDash on the robot should try connecting to the robot IP automatically
Our elevator will be on the CANivore, so we will take advantage of our Phoenix Pro license
Add teleoperated controls based on the control map in the Google Drive
Use the example code for trajectories in https://github.com/Team973/2023-alphabot/blob/main/src/main/java/frc/robot/Robot.java#L92
Create an auto command that picks up a game piece
public PickupGamePiece(Claw claw, GamePiece gamePiece) {
//...
}
m_claw.setGamePiece
with the game piece we passed to the constructorm_claw.setIntakeState(IntakeState.In)
The candle is staying on after we score. More specifically, it turns off when we hold the score button, then turns back on
It should stay off
To research and test April tags with the new Limelight firmware
Create a basic arm subsystem
arm-init
setArmRotationOutput(double percent)
private double m_armMotorOutput = 0.0
and update this with the setArmRotationOutput(double percent)
methodCreate a black-box claw system
claw-init
open()
close()
intake()
outtake()
this.clampState = ClampState.OPEN
this.clampState = ClampState.CLOSED
this.clampState = IntakeState.IN
this.clampState = IntakeState.OUT
private enum
switch(m_clampState) {
case: ClampState.OPEN:
break;
case: ClampState.CLOSED:
break;
default:
break;
}
and also something similar for IntakeState
See swerve implementation in https://github.com/Team973/2023-alphabot
The pickup command should be refactored to allow different intake options
Update Arm subsystem to reflect the latest CAD.
arm-cad-update
private enum ExtensionState {
RETRACTED,
EXTENDED
}
Also initialize: private ExtensionState m_extensionState = ExtensionState.RETRACTED
and in update()
switch (m_extensionState) {
case RETRACTED:
m_armSolenoid.set(false);
break;
case EXTENDED:
m_armSolenoid.set(true);
break;
default:
break;
}
We need to install vendor deps so we can use libraries such as CTRE
vendordeps
Let's port the autonomous framework to java and update some of the pain-points.
Clean up RobotInfo.java.
Tune the Elevator so that it works.
Create a Java client to add charts and other data to GreyDash
Create a WristAngleCommand
that will set the wrist to a specific angle.
init
will set the wrist to the angle provided in the constructorrun
will be empty since the wrist update function handles the adjustmentisCompleted
checks hasElapsed
to see if the command has timed out and checks if the wrist is at the target angle.To keep us from tipping, we should reduce how fast we spin when the elevator is up
final double rot =
-m_rotLimiter.calculate(MathUtil.applyDeadband(m_driverStick.getRawAxis(4), 0.09))
* DriveInfo.MAX_ANGULAR_VELOCITY_RADIANS_PER_SECOND;
remove the final from this variable
Do some math on the rotation input to reduce it based on elevator height, for example:
if (m_elevator.getHeight() > Elevator.Presets.Mid) {
rot = rot * 0.5;
}
Bundle and deploy GreyDash w/ a minimal web server thread
Create a util function that sets all of the TalonFX config values to zero.
Also log exceptions during robotInit, disabledInit, autonomousInit, teleopInit, testInit in Robot.java
for example:
@Override
public void autonomousInit() {
try {
// Put all the existing code here
} catch (Exception e) {
logException(e);
}
}
Do this for all of the init functions in Robot.java
To learn and implement swerve trajectories for season's autonomous mode.
Make the CANdle indicate when an automode is selected in GreyDash.
Given the Elevator code, implement and tune motion magic presets
Research PathPlanner trajectories and implement it into a new AutoCommand.
In RobotInfo.java
21.250" x 21.250"
Create a basic elevator subsystem
elevator-init
setElevatorOutput(double percent)
m_elevatorOutput
Add a zeroing routine for the elevator. We will have a hall effect sensor (DigitalInput in code) to tell us when the elevator is at the bottom.
Similar to the turret in this last offseason, we should go into brake mode when we have successfully zeroed.
m_bottomHall
Update Elevator to match CAD: Add 2nd motor
elevator-motor-follower
private final TalonFX m_elevatorFollowerMotor
and a fake ID in RobotInfo.javam_elevatorFollowerMotor.follow(m_elevatorMotor);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.