I am trying to implement the Path Planner RamseteAutoBuilder into my project, but am having some issues. When I attempt to run auto, the program seems to crash and then restart. There are also no messages in the console when this occurs. I talked to Michael the developer of Path Planner and we could not come up with a solution yet. I was hoping somebody else might have an idea. Here is the code in the GetAutonomousCommand for Path Planner and the code in AutonomousInit as well.
frc2::CommandPtr RobotContainer::GetAutonomousCommand() {
std::vector<pathplanner::PathPlannerTrajectory> traj = pathplanner::PathPlanner::loadPathGroup(m_autoChooser.GetSelected(), {pathplanner::PathConstraints(4_mps, 3_mps_sq)});
pathplanner::RamseteAutoBuilder ramseteCommand{[this]() {return m_drivetrain.GetPose();},
[this] (frc::Pose2d pose) {m_drivetrain.ResetOdometry(pose);},
frc::RamseteController{DriveConstants::kRamseteB * 1_rad * 1_rad / (1_m * 1_m),
DriveConstants::kRamseteZeta / 1_rad},
DriveConstants::kDriveKinematics,
frc::SimpleMotorFeedforward<units::meters>{DriveConstants::kS, DriveConstants::kV, DriveConstants::kA},
[this] {return m_drivetrain.GetWheelSpeed();},
{DriveConstants::kPDriveVel, 0, 0},
[this] (auto left, auto right) {m_drivetrain.DriveVolts(left, right);},
eventMap,
{&m_drivetrain}, false};
return ramseteCommand.fullAuto(traj);
It’s worth noting that m_autoChooser
pulls from a list of strings that are selected via the dashboard to choose the desired autonomous.
void Robot::AutonomousInit() {
m_autonomousCommand = m_container.GetAutonomousCommand();
if (m_autonomousCommand) {
m_autonomousCommand->Schedule();
}
}