diff --git a/docs/choreolib/auto-routines.md b/docs/choreolib/auto-routines.md index c58e1f7f44..ef93b1e5ae 100644 --- a/docs/choreolib/auto-routines.md +++ b/docs/choreolib/auto-routines.md @@ -1,7 +1,6 @@ # Auto Routines -Choreolib provides a higher level API to make it easier to create competitive and complex auto routines inside your robot code. -This is done by providing the `AutoFactory` class. +ChoreoLib provides the `AutoFactory` class as higher level API to make it easier to create competitive and complex auto routines inside your robot code. ## Triggers vs Composition diff --git a/docs/choreolib/basic-usage.md b/docs/choreolib/basic-usage.md new file mode 100644 index 0000000000..04a3c3a183 --- /dev/null +++ b/docs/choreolib/basic-usage.md @@ -0,0 +1,33 @@ +# Basic Usage + +Teams that want to use their own path following structure can load trajectories directly with the following code. + +``` { .java .select } +import java.util.Optional; + +import choreo.Choreo; +import choreo.trajectory.ChoreoTrajectory; +import choreo.trajectory.SwerveSample; + +// Loading a trajectory from a file, returns an optional if the file does not exist or is invalid +var trajectory = Choreo.loadTrajectory("myTrajectory"); + +if (trajectory.isPresent()) { + // Do something with the trajectory + drive.followTrajectory(trajectory.get()).schedule(); +} else { + // If the trajectory is not found choreolib already prints to DriverStation +} +``` + +``` { .cpp .select } +#include + +// Loading a trajectory from a file, returns an optional if the file does not exist or is invalid +if (auto trajectory = choreo::LoadTrajectory("myTrajectory")) { + // Do something with the trajectory + drive.followTrajectory(trajectory.value()).schedule(); +} else { + // If the trajectory is not found choreolib already prints to DriverStation +} +``` diff --git a/docs/choreolib/lowlevel-usage.md b/docs/choreolib/lowlevel-usage.md deleted file mode 100644 index f56f018d39..0000000000 --- a/docs/choreolib/lowlevel-usage.md +++ /dev/null @@ -1,24 +0,0 @@ -# Low-level usage - -Choreolib aims to support a wide range of use cases. -Many teams like to use their own path following structure and this was somewhat encouraged in 2023. -To not leave these teams behind, Choreolib provides a lower level API that allows you to directly load trajectories -and use them in your own path following code. - -``` { .java .select } -import java.util.Optional; - -import choreo.Choreo; -import choreo.trajectory.ChoreoTrajectory; -import choreo.trajectory.SwerveSample; - -// Loading a trajectory from a file, returns an optional if the file does not exist or is invalid -Optional> optTrajectory = Choreo.getTrajectory("myTrajectory"); - -if (optTrajectory.isPresent()) { - // do something with the trajectory - drive.followTrajectory(optTrajectory.get()).schedule(); -} else { - // if the trajectory is not found choreolib already prints to DriverStation -} -``` diff --git a/docs/choreolib/samples.md b/docs/choreolib/samples.md index a95e780443..ceb8ea9c5e 100644 --- a/docs/choreolib/samples.md +++ b/docs/choreolib/samples.md @@ -1,7 +1,6 @@ # Samples -Choreolib supports swerve and differential drive systems. -The only usage difference between using swerve and differential is the type of the sample used. +ChoreoLib supports swerve and differential drive systems. The only usage difference between using swerve and differential is the type of the sample used. ## Swerve Drive diff --git a/mkdocs.yml b/mkdocs.yml index 9f5ac95f79..7cc383101a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -94,7 +94,9 @@ nav: - Estimating Moment of Inertia: usage/estimating-moi.md - ChoreoLib: - Installation: choreolib/installation.md - - Usage: choreolib/usage.md + - Basic Usage: choreolib/basic-usage.md + - Samples: choreolib/samples.md + - Auto Routines: choreolib/auto-routines.md - Java API: api/choreolib/java/index.html - C++ API: api/choreolib/cpp/index.html - TrajoptLib: