i am starting in command based and i am using the SwerveControllerCommand with the Trajectory method. But i dont know how to make something work in parallel with that. Because i dont want to use a timer to get the subsystems working, I want to know which point in the trajectory the robot has already passed so that when it passes a certain point it activates the subsystem.
One method you can use is to run a command if the pose of the robot is in a range (we can’t check for an exact pose since there will be some range of error). You can also use PathPlannerLib and PathPlanner to make trajectories and put event markers on the trajectory. Each event marker can be assigned a command which it will run once the robot is at the event marker. This approach is more accurate than the first approach.
is it possible to do that with pathweaver ?
Event markers are not possible in Pathweaver. However, you can check if the robot’s pose is in a certain range and then schedule a command.
Heyyy, so my team and me are on the step of making event markers, could pleas provide more info?
Like, where or how do you specify which command of your code you want to run?
If you could send a code snippet or photo of how it is done, I’d be pleased
Tysm
You would first in the PathPlanner GUI, create named commands and assign them to event marker(s). Then you assign what command to run to that named command. For example the named command is called “deploy” and the command associated with that would be deployIntake().
Here is the documentation pages for it:
https://pathplanner.dev/pplib-named-commands.html
https://pathplanner.dev/gui-editing-paths-and-autos.html#paths
Hope this helped!
If you make it a regular command, with the execute method, you can check the current robot pose from your odometry.
However, it’s MUCH easier to do with tools like PathPlanner, which has a concept of markers/wayponts where you can run commands, concurrently with the trajectory driving if needed.