Our robots odometry system is working and is capable of following paths during autonomous, however I want to be able to have the robot do other tasks while moving along its path, for example: lowering an intake to pick up notes and raising said intake.
I reasoned I could do this by creating a path to the first note, moving intake, creating another path… etc. but this is very inefficient and I know there is another way to do this, but don’t know what it is.
Here is how I am running the autonomous command currently, in RobotContainer:
Trajectory ExampleTrajectory =
TrajectoryGenerator.generateTrajectory(
// Start at the origin facing the +X direction
m_robotDrive.getPose(),
// Pass through these two interior waypoints, making an ‘s’ curve path
List.of(new Translation2d(Units.inchesToMeters(114), Units.inchesToMeters(161.64))),
// End 3 meters straight ahead of where we started, facing forward
new Pose2d(Units.inchesToMeters(150), Units.inchesToMeters(293.64), new Rotation2d(0)),
config);
SwerveControllerCommand swerveControllerCommand =
new SwerveControllerCommand(
exampleTrajectory,
m_robotDrive::getPose, // Functional interface to feed supplier
DriveConstants.kDriveKinematics,
// Position controllers
new PIDController(AutoConstants.kPXController, 0, 0),
new PIDController(AutoConstants.kPYController, 0, 0),
thetaController,
m_robotDrive::setModuleStates,
m_robotDrive);
return swerveControllerCommand.andThen(() → m_robotDrive.drive(0.0, 0.0, 0.0, false, true));
Thanks for reading