Scrappy, Not Crappy

Here is a repo that provides a barebones robot simulation example with a CTRE swerve drive base, deployable intake & roller, and PhotonVision sim. Note that this is meant to be used as a reference, not as a base template for a real robot.

I want to reiterate that nothing here is novel; we’re standing on the shoulders of giants and just assembling components that others have built. Maybe the most unique thing is how we use Mechanism2d ligaments to visualize spinning rollers. It looks a bit silly but it’s functional.

I think one thing to be careful about is making sure that when updating the motor sim based on the physics sim, you’re not leaking information that would not be present on the real robot. It requires some thoughtfulness and verification to make sure that the sim matches the real robot in terms of where the zero point is on your mechanisms/motors/sensors.

12 Likes

Thanks for sharing this! I just wanted to mention another method I have used to visualize intake rotation in sim. It works by setting the color of the roller to a shade of red (for backward) or green (for forwards) based on the speed.

double int_spd=intakeSubsystem.intake_speed_percent;
if(Math.abs(int_spd)<0.01){
   intakeTop.setColor(new Color8Bit(Color.kSilver));
   intakeBottom.setColor(new Color8Bit(Color.kSilver));
} else if (int_spd>0){
    intakeBottom.setColor(new Color8Bit(new Color(0.0,int_spd,0.0)));
    intakeTop.setColor(new Color8Bit(new Color(0.0,int_spd,0.0)));
} else{
    intakeBottom.setColor(new Color8Bit(new Color(-1*int_spd,0.0,0.0)));
    intakeTop.setColor(new Color8Bit(new Color(-1*int_spd,0.0,0.0)));
}
3 Likes

Also, when and where will the pit crate CAD be released? Looks great btw.

We’ll probably post it some time next week, still need some time for the team to clean up / organize the CAD

1 Like