RobotPathfinder
Robot motion profiler/path planner for use in FRC Java programming
Install / Use
/learn @tylertian123/RobotPathfinderREADME
RobotPathfinder
Robot motion profiler/path planner for tank drive (aka skid-steer or differential drive) robots. Developed by Tyler Tian for use by FRC Team 6135 (Arctos). Inspired by and partially based on Pathfinder by Jaci Brunning.
RobotPathfinder is intended as an improvement over Pathfinder for tank drivetrains. As such, it does not have support for other drivetrains, but has these features:
- Smooth path generation with 3 different fit types
- Respects maximum velocity constraints for both wheels, even when turning
- Allows wheels to turn backwards if turns are too tight
- Simple motion profiles that can be re-generated on-the-fly for maximum speed and accuracy
- Handy methods that allows the mirroring and retracing of trajectories
- Follower class that can be set to follow position, velocity, acceleration and direction
- And much more...!
Purpose
Given an array of waypoints, each with coordinates, a heading, and optionally a velocity, RobotPathfinder generates a smooth path that follows all the waypoints. Then, using that path, it generates left and right wheel trajectories for a robot to follow in order to achieve the desired path.
Example path:
<br>
Trajectory for the example path:
<br>
These graphs are generated using <b>JMathPlot</b>. You can find its repository <a href="https://github.com/yannrichet/jmathplot">here</a>.<br>
A Note on Versions
There are currently 3 major versions of RobotPathfinder (v1, v2 and v3):
- v1 is outdated and inaccurate. You should never use it.
- v2 has been extensively used and tested and is stable.
- v3 is still in its alpha stage. It uses native code to speed up execution and is on average 4 times as fast as v2. The API is still undergoing rapid development, so usage at this moment is not recommended unless you know what you're doing.
Usage
Every release contains 3 jars, 1 zip, and numerous dynamic libraries:
RobotPathfinder-(VERSION).jar- The basic jar that contains the library, but without some dependencies. This is the jar recommended for use on a robot. It does not contain the dependencies required for graphing.RobotPathfinder-(VERSION)-all.jar- The fat jar that contains the library as well as all its dependencies (JMathPlot, Gson).Trajectory-Visualizer-(VERSION).jar- The executable jar that contains the GUI Trajectory Visualization Tool (and all its dependencies).RobotPathfinder-Doc-(VERSION).zip- The zip that contains the Javadocs for all classes and methods.libRobotPathfinder-(PLATFORM).so- (In v3 only) The native dynamic library used by RobotPathfinder for a specific Linux arch.RobotPathfinder-(PLATFORM).dll- (In v3 only) The native dynamic library used by RobotPathfinder for a specific Windows arch.
Alternatively, you can build the binaries yourself by navigating to the root directory, and running ./gradlew allArchives --rerun-tasks. (If you're on a Windows machine, make sure you're using PowerShell not cmd!) The archives can then be found under the archives directory.
In order to use RobotPathfinder v3, the correct dynamic library for your platform must be present in either the directory java is invoked from, or the library path.
FRC Usage
GradleRIO
- Put the jar and (v3 only) the native library for roboRIO in a folder somewhere in the project, e.g.
lib(if using v3, make sure to rename the dynamic library fromlibRobotPathfinder-roboRIO.soto justlibRobotPathfinder.so!) - In
build.gradle, underdependencies, add this line:compile files('path/to/jar')and (v3 only)nativeLib files('path/to/native-lib') - Your new
dependenciesshould look something like this:
dependencies {
compile wpi.deps.wpilib()
compile wpi.deps.vendor.java()
compile files('lib/RobotPathfinder-3.0.0-alpha.0.jar')
nativeLib files('lib/libRobotPathfinder.so') // v3 only
nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)
testCompile 'junit:junit:4.12'
}
Eclipse
- Put the jar in a folder somewhere in the project, e.g.
lib - Expand the project in Eclipse, right-click Referenced Libraries, Build Path -> Configure Build Path
- I
