PathBuilder
This utility class is designed for building sequences of PointXYZ targets and generating corresponding Trajectory or Follower lists. It simplifies the process of defining a path for a robot to follow, offering options for both linear and fast trajectories.
Methods
PathBuilder()
Constructs a new PathBuilder with an initial capacity of 10 for its internal list of targets.
PathBuilder(int initialSize)
Constructs a new PathBuilder with a specified initial capacity for its internal list of targets.
followersFromTrajectories(Robot robot, FollowerGenerator followerGenerator, List<Trajectory> trajectories)
Static method. Converts a list of Trajectory objects into a list of Follower objects using the provided FollowerGenerator and Robot instance.
getTargets()
Returns the internal List of PointXYZ targets that have been added to this PathBuilder.
linearPath(double speed, double tolerance, Angle angleTolerance)
Generates a List of LinearTrajectory objects based on the currently added targets. Each LinearTrajectory will use the specified speed, tolerance, and angleTolerance.
fastPath(PointXYZ start, double speed)
Generates a List of FastTrajectory objects based on the currently added targets. The first trajectory will start from the provided start point, and subsequent trajectories will start from the end point of the previous one. All trajectories will use the specified speed.
linearPathFollowers(Robot robot, FollowerGenerator followerGenerator, double speed, double tolerance, Angle angleTolerance)
Generates a List of Follower objects that will execute a linear path. This method combines linearPath with followersFromTrajectories.
fastPathFollowers(Robot robot, FollowerGenerator followerGenerator, double speed)
Generates a List of Follower objects that will execute a fast path. This method combines fastPath with followersFromTrajectories, using the robot's current position as the starting point for the first trajectory.
addTarget(PointXYZ target)
Adds a single PointXYZ as a target to the path.
addTarget(Angle angleToMoveAt, double distanceToMove)
Adds a new target point to the path by calculating a point distanceToMove away from the last added target, in the direction specified by angleToMoveAt. If no targets have been added yet, this method will likely result in an error or unexpected behavior.