Skip to content

Conversation

RobototesProgrammers
Copy link
Contributor

No description provided.

LiveWindow.disableAllTelemetry();
LiveWindow.enableTelemetry(PDH);
mech = new Mechanism2d(1, 2);
root = mech.getRoot("climber", 0.5 + Units.inchesToMeters(5.5), Units.inchesToMeters(19.5));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? Not sure what the "climber" is, as this year's robot isn't supposed to climb.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funnel pivot?

root = mech.getRoot("climber", 0.5 + Units.inchesToMeters(5.5), Units.inchesToMeters(19.5));
SmartDashboard.putData("Mechanism", mech);
m_elevator =
root.append(new MechanismLigament2d("elevator", 1, 90, 2, new Color8Bit(Color.kRed)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth a comment that this is a single-stage elevator even though the robot actually uses a multi-stage elevator.

public static final double CORAL_QUICK_INTAKE = 1.6;
public static final double MIN_EMPTY_GROUND_INTAKE = 4.5;
public static final double MIN_FULL_GROUND_INTAKE = 8.0;
private static final double MOTOR_ROTATIONS_PER_METER = 40; // Inaccurate
Copy link
Member

@jamesdooley4 jamesdooley4 Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be able to make this accurate by measuring how far the elevator extends (in meters) at CORAL_LEVEL_FOUR_PRE_POS and then simply change this to 37.5 / <actual relative elevator extension>, where <actual relative elevator extension> is what's measured with a tape measure.

Comment on lines +50 to +53
Mechanism2d mech;
MechanismRoot2d root;
MechanismLigament2d m_elevator;
MechanismLigament2d m_wrist;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nicer to encapsulate the Mechanism (and similar "report physical position") code in a different class instead of adding it to the main Robot class. These are generally called 'digital twins', so could use something like DigitalTwin.java and have robotPeriodic() simply call an update() function on it.

m_motorOneSimState.setRawRotorPosition(targetPos);
m_motorTwoSimState.setRawRotorPosition(targetPos);

elevatorPose3d.set(new Pose3d(new Pose2d(0.0, getHeightMeters(), new Rotation2d(0.0,0.0))));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running this in the simulator, it's continually logging this error here:

Error at java.base/java.lang.Thread.getStackTrace(Thread.java:1619): x and y components of Rotation2d are zero

        at java.base/java.lang.Thread.getStackTrace(Thread.java:1619)
        at edu.wpi.first.math.geometry.Rotation2d.<init>(Rotation2d.java:126)
        at frc.robot.subsystems.ElevatorSubsystem.periodic(ElevatorSubsystem.java:388)
        at edu.wpi.first.wpilibj2.command.CommandScheduler.run(CommandScheduler.java:269)
        at frc.robot.Robot.robotPeriodic(Robot.java:137)
        at edu.wpi.first.wpilibj.IterativeRobotBase.loopFunc(IterativeRobotBase.java:400)
        at edu.wpi.first.wpilibj.TimedRobot.startCompetition(TimedRobot.java:148)
        at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:419)
        at edu.wpi.first.wpilibj.RobotBase.lambda$startRobot$1(RobotBase.java:490)
        at java.base/java.lang.Thread.run(Thread.java:840)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants