Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

zachwaffle4
Copy link
Contributor

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 into TrajectoryActionBuilder for the actionBuilder method.
  • followTrajectory(Trajectory trajectory, double t) is essentially the run method for FollowTrajectoryAction. If t >= trajectory.duration it stops all motors and then returns true; otherwise it does the exact same thing that FollowTrajectoryAction.run does and then returns false.
  • followTrajectoryBlocking(Trajectory trajectory) simply runs trajectory starting from t=0 and then increasing t the same way the FollowTrajectoryAction does until followTrajectory(trajectory, t) returns false.
  • followTrajectoriesBlocking(List<Trajectory> trajectories) essentially iterates through trajectories and calls followTrajectoryBlocking 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.

@rbrott
Copy link
Member

rbrott commented Dec 27, 2024

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 don't see why you need to change the implementation of MecanumDrive/TankDrive to accomplish this goal. The required ingredients (TrajectoryBuilder, FollowTrajectoryAction, setDrivePowers()) are all available publicly. Is there something you can't accomplish without internally modifying MecanumDrive?

@Iris-TheRainbow
Copy link

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

@rbrott
Copy link
Member

rbrott commented Jan 3, 2025

The current setup requires large amounts of mods to mec drive to run things without actions.

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.

@Iris-TheRainbow
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants