Interface Segment
public interface Segment
Trajectory segments are the core components behind trajectories, which are
best represented as a combination of segments. Segments can take on any form
you'd desire - splines, arcs, curves, regular old lines, etc - just about
whatever you want. The
Segment
interface is designed to provide an
easy way to meld together different representations of trajectory segments,
allowing for simplified complex path management and following.
Trajectory segments don't actually do very much on their own. For example, robot jerk is not taken into account when generating and/or following any given trajectory. Thus, trajectory segments must be constructed in a way such that the robot CAN accurately follow the trajectory. Whether this means slowing the robot down, making the segment "larger" (for curves, really) or whatever other modifications need to be made, these modifications are to be handled by the user, not us.
All trajectory segments should provide methods for interpolating a point on the segment based on either an X or a Y value.
- Since:
- 0.3.0
- Author:
- Colin Robertson
-
Method Summary
Modifier and Type Method Description Angle
angleAt(Point point)
Get the angle which the robot should be facing at the given trajectory.Point
end()
Get the point where the segment ends.Point
interpolateFromX(double xValue)
Get a point from the segment based on an X value.Point
interpolateFromY(double yValue)
Get a point from the segment based on an Y value.Point
maximum()
Get a combination of the maximum X and Y values for the segment.Point
minimum()
Get a combination of the minimum X and Y values for the segment.Point
start()
Get the point where the segment starts.
-
Method Details
-
interpolateFromX
Get a point from the segment based on an X value. This point should fit within the bounds of the segment and should be represented partially by the provided value, which provides a basis for interpolation from there.- Parameters:
xValue
- the value that the segment should interpolate from. This means, in essence, that the segment should determine the nearest possible point to the requested X value.- Returns:
- an interpolated point based on an inputted value. This point has no regard for heading - rather, it's a simple and plain point that can be used for following the trajectory or just figuring out where a certain value on the trajectory lies.
-
interpolateFromY
Get a point from the segment based on an Y value. This point should fit within the bounds of the segment and should be represented partially by the provided value, which provides a basis for interpolation from there.- Parameters:
yValue
- the value that the segment should interpolate from. This means, in essence, that the segment should determine the nearest possible point to the requested Y value.- Returns:
- an interpolated point based on an inputted value. This point has no regard for heading - rather, it's a simple and plain point that can be used for following the trajectory or just figuring out where a certain value on the trajectory lies.
-
angleAt
Get the angle which the robot should be facing at the given trajectory. This angle is handled separately from the interpolation methods to increase the degree of flexibility theSegment
interface will provide both internally and externally.- Parameters:
point
- the point that will serve as a basis for fetching the desired robot heading.- Returns:
- the most closely interpolated heading/angle at a given point. This angle typically corresponds to how far along the segment the robot has travelled, but it's up to the implementations of the segment class to decide how exactly this is handled. Yay interfaces!
-
minimum
Point minimum()Get a combination of the minimum X and Y values for the segment. This point is used to reduce primitive clutter - instead of returning an individual X and Y double, we can return a single point that represents our requested information.- Returns:
- a combination of the requested X and Y values. This is used mostly in segment interpolation, as individual segments are predicated on raw X and Y coordinates, not interpolatable coordinates.
-
maximum
Point maximum()Get a combination of the maximum X and Y values for the segment. This point is used to reduce primitive clutter - instead of returning an individual X and Y double, we can return a single point that represents our requested information.- Returns:
- a combination of the requested X and Y values. This is used mostly in segment interpolation, as individual segments are predicated on raw X and Y coordinates, not interpolatable coordinates.
-
start
Point start()Get the point where the segment starts. This is defined as the position that represents 0 percent of the segment's completion.- Returns:
- the point at which the segment begins.
-
end
Point end()Get the point where the segment ends. This is defined as the position that represents 100 percent of the segment's completion.- Returns:
- the point at which the segment ends.
-