-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pure Trajectory Builders and Followers #464
base: master
Are you sure you want to change the base?
Conversation
I don't see why you need to change the implementation of |
I have admittedly not looked at zach's exact changes, however, the end goal is to be able to functionally run trajectories in other systems without the need to run actions. The current setup requires large amounts of mods to mec drive to run things without actions. opening the follow trajectory functions as a non action api then wrapping them as actions for use with stock RR would be amazing for using rr for driving with non-actions mechanism control systems |
Is there any place I can see these prior attempts? I'd like to prove to myself that the current API is inadequate with a concrete example. |
you can see how i did it in my teamcode (my mecanum drive is kinda hellish nowadays, im scared to try and merge the new localizer stuff, might have to do it by hand) https://github.com/Iris-TheRainbow/27971-IntoTheDeep-Teamcode/ The issue is that all following is done as Actions right now. we have to duplicate all follower code to be able to follow without running an action |
With the current version of the Quickstart, the only easy way to create a trajectory is by using the TrajectoryActionBuilder. This is amazing for most use cases until you want to use a command base other than the RoadRunner Action system.
I've created methods in MecanumDrive and TankDrive that allow users to create TrajectoryBuilders and then run Trajectories somewhat similarly to how they would in RoadRunner 0.5 (though that isn't necessarily the intended use case):
trajectoryBuilder(Pose2d beginPose)
simply creates a TrajectoryBuilder using the same parameters that are passed intoTrajectoryActionBuilder
for theactionBuilder
method.followTrajectory(Trajectory trajectory, double t)
is essentially therun
method forFollowTrajectoryAction
. Ift >= trajectory.duration
it stops all motors and then returns true; otherwise it does the exact same thing thatFollowTrajectoryAction.run
does and then returns false.followTrajectoryBlocking(Trajectory trajectory)
simply runstrajectory
starting from t=0 and then increasing t the same way the FollowTrajectoryAction does untilfollowTrajectory(trajectory, t)
returns false.followTrajectoriesBlocking(List<Trajectory> trajectories)
essentially iterates throughtrajectories
and callsfollowTrajectoryBlocking
on each one. There is a tiny bit of lag as the robot stops between trajectories.I understand the reasons for not including this because of Actions, but this allows users to incorporate trajectories into other command base systems much more easily without having to convert their commands into actions first.