Skip to content

PigeonIMU sim doesn't work when connected to a TalonSRX #96

@sampdubs

Description

@sampdubs

I am working on simulating my team's 2022 robot. I was having issues with simulating the Pigeon IMU, and after a lot of digging through source code and trial and error, I found that the simulation worked as expected if instead of constructing the WPI_PigeonIMU object using a Talon (which reflects how it is wired on the bot), if I instead constructed it with a device ID (meaning it would be wired to the CAN bus), simulation works as it should. I would expect simulation to work the same whether the IMU is connected through CAN or a Talon data port.

For reference, this code does not change the simulated IMU angle:

WPI_TalonSRX talon = new WPI_TalonSRX(1);
WPI_PigeonIMU pigeon = new WPI_PigeonIMU(talon);
pigeon.getSimCollection().setRawHeading(drivetrainSim.getHeading().getDegrees());

And this code does change the simulated angle, reflecting what would be expected given drivetrain inputs:

WPI_PigeonIMU pigeon = new WPI_PigeonIMU(2);
pigeon.getSimCollection().setRawHeading(drivetrainSim.getHeading().getDegrees());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions