I am trying to get some more complex autos working with PathWeaver and Ramsete Command.
I created a parallel race group so I can run the intake while following a path and when it gets to the end of the path it will shut the intake off. I am passing in a Trajectory to this command group for use with the Ramsete Command. I am also passing in my drivetrain.
When I run drivetrain.resetOdometry(trajectory.getInitialPose(); it does not enter the drivetrain and reset the initial pose, but when I put it in getAutonomousCommand it does enter that and reset it. The issue with it there is I dont know how to get it to change to the correct trajectory based on which auto is selected.
I am working with TwoBallBlue2 command and the FollowPathAndIntake … Below is the github repository.
You’re putting the reset command in the constructor, so it runs when the command is constructed (at robot startup). One way to make sure that it’s called at runtime is to add it as an InstantCommand at the beginning of the group…
Ok that makes sense… but I have a dumb question… what does that look like?
new InstantCommand (drivetrain.resetOdometry(trajectory.getInitialPose())),
Didn’t think this would work since the method for resetting odometry isn’t a command?…. Very new to Java so staying to figure this all out
Isn’t the cosnstructor run everytime a new instance of the command is called and therefore running when calling the new command from getAutonomousCommand? (It is not apprently. Just trying to understand the issue)
That works great and seems to fix the problem I was having, but it has created another issue. I had the RamseteCommand and RunIntake commands in a ParallelRaceGroup. Problem is adding the InstantCommand ends immediately and terminates the race group.
I am trying to move this over to a ParallelDeadlineGroup so that it ends once the ramseteCommand ends, but I am doing something wrong when trying to add the ramseteCommand as a deadline command and I am not sure what that is. Any advice on using the ParallelDeadlineGroup?
It does not like how I am adding the RamseteCommand in line 45 of this command
Ok, that makes sense too… and the parallelCommandGroup could be a race or deadlineGroup whatever I needed to make it end and move on to the next one.