Volocopter

Dubins

img/twoturnssame.svg
class dubins.Dubins(radius, point_separation)[source]

Class implementing a Dubins path planner with a constant turn radius.

Attributes:
radius : float

The radius of the turn used in all the potential trajectories.

point_separation : float

The distance between points of the trajectories. More points increases the precision of the path but also augments the computation time of the colision check.

Methods

dubins_path(start, end) Computes all the possible Dubin’s path and returns the sequence of points representing the shortest option.
generate_points_straight(start, end, path) For the 4 first classes of dubins paths, containing in the middle a straight section.
generate_points_curve(start, end, path) For the two last paths, where the trajectory is a succession of 3 turns.
find_center(point, side) Given an initial position, and the direction of the turn, computes the center of the circle with turn radius self.radius passing by the intial point.
lsl(start, end, center_0, center_2) Left-Straight-Left trajectories.
rsr(start, end, center_0, center_2) Right-Straight-Right trajectories.
rsl(start, end, center_0, center_2) Right-Straight-Left trajectories.
lsr(start, end, center_0, center_2) Left-Straight-Right trajectories.
lrl(start, end, center_0, center_2) Left-right-Left trajectories.
rlr(start, end, center_0, center_2) Right-left-right trajectories.
all_options(start, end, sort=False)[source]

Computes all the possible Dubin’s path and returns them, in the form of a list of tuples representing each option: (path_length, dubins_path, straight).

Parameters:
start : tuple

In the form (x, y, psi), with psi in radians. The representation of the inital point.

end : tuple

In the form (x, y, psi), with psi in radians. The representation of the final point.

sort : bool

If the list of option has to be sorted by decreasing cost or not.

Returns:
The shortest list of points (x, y) linking the initial and final points
given as input with only turns of a defined radius and straight line.
circle_arc(reference, beta, center, x)[source]

Returns the point located on the circle of center center and radius defined by the class, at the angle x.

Parameters:
reference : float

Angular starting point, in radians.

beta : float

Used actually only to know the direction of the rotation, and hence to know if the path needs to be added or substracted from the reference angle.

center : tuple

(x, y) coordinates of the center of the circle from which we need a point on the circumference.

x : float

The lenght of the path on the circle.

Returns:
The coordinates of the point on the circle, in the form of a tuple.
dubins_path(start, end)[source]

Computes all the possible Dubin’s path and returns the sequence of points representing the shortest option.

Parameters:
start : tuple

In the form (x, y, psi), with psi in radians. The representation of the inital point.

end : tuple

In the form (x, y, psi), with psi in radians. The representation of the final point.

Returns:
The shortest list of points (x, y) linking the initial and final points
given as input with only turns of a defined radius and straight line.
In the form of a (2xn) numpy array.
find_center(point, side)[source]

Given an initial position, and the direction of the turn, computes the center of the circle with turn radius self.radius passing by the intial point.

Parameters:
point : tuple

In the form (x, y, psi), with psi in radians. The representation of the inital point.

side : Char

Either ‘L’ to indicate a left turn, or ‘R’ for a right turn.

Returns:
coordinates : 2x1 Array Like

Coordinates of the center of the circle describing the turn.

generate_points(start, end, dubins_path, straight)[source]

Transforms the dubins path in a succession of points in the 2D plane.

Parameters:
start: tuple

In the form (x, y, psi), with psi in radians. The representation of the inital point.

end: tuple

In the form (x, y, psi), with psi in radians. The representation of the final point.

dubins_path: tuple

The representation of the dubins path in the form of a tuple containing:

  • the angle of the turn in the first circle, in rads.
  • the angle of the turn in the last circle, in rads.
  • the angle of the turn in the central circle, in rads, or the

length of the central segment if straight is true.

straight: bool

True if their is a central segment in the dubins path.

Returns:
The shortest list of points (x, y) linking the initial and final points
given as input with only turns of a defined radius and straight line.
In the form of a (2xn) numpy array.
generate_points_curve(start, end, path)[source]

For the two last paths, where the trajectory is a succession of 3 turns. First computing the position of the center of the central turn, then using the three circles to apply the angles given in the path argument.

Parameters:
start : tuple

Start position in the form (x, y, psi).

end : tuple

End position in the form (x, y, psi).

path : tuple
The computed dubins path, a tuple containing:
  • the angle of the turn in the first circle, in rads
  • the angle of the turn in the last circle, in rads
  • the angle of the turn in the central circle, in rads

A negative angle means a right turn (antitrigonometric), and a positive angle represents a left turn.

Returns:
The shortest list of points (x, y) linking the initial and final points
given as input with only turns of a defined radius. In the form of a
(2xn) numpy array.
generate_points_straight(start, end, path)[source]

For the 4 first classes of dubins paths, containing in the middle a straight section.

Parameters:
start : tuple

Start position in the form (x, y, psi).

end : tuple

End position in the form (x, y, psi).

path : tuple
The computed dubins path, a tuple containing:
  • the angle of the turn in the first circle, in rads
  • the angle of the turn in the last circle, in rads
  • the length of the straight line in between

A negative angle means a right turn (antitrigonometric), and a positive angle represents a left turn.

Returns:
The shortest list of points (x, y) linking the initial and final points
given as input with only turns of a defined radius and straight line.
In the form of a (2xn) numpy array.
lrl(start, end, center_0, center_2)[source]

Left-right-Left trajectories. Using the isocele triangle made by the centers of the three circles, computes the required angles.

img/threeturns.svg
Parameters:
start : tuple

(x, y, psi) coordinates of the inital point.

end : tuple

(x, y, psi) coordinates of the final point.

center_0 : tuple

(x, y) coordinates of the center of the first turn.

center_2 : tuple

(x, y) coordinates of the center of the last turn.

Returns:
total_len : float

The total distance of this path.

(beta_0, beta_2, straight_dist) : tuple

The dubins path, i.e. the angle of the first turn, the angle of the last turn, and the length of the straight segment.

straight : bool

False, to indicate that this path does not contain a straight part.

lsl(start, end, center_0, center_2)[source]

Left-Straight-Left trajectories. First computes the poisition of the centers of the turns, and then uses the fact that the vector defined by the distance between the centers gives the direction and distance of the straight segment.

img/twoturnssame.svg
Parameters:
start : tuple

(x, y, psi) coordinates of the inital point.

end : tuple

(x, y, psi) coordinates of the final point.

center_0 : tuple

(x, y) coordinates of the center of the first turn.

center_2 : tuple

(x, y) coordinates of the center of the last turn.

Returns:
total_len : float

The total distance of this path.

(beta_0, beta_2, straight_dist) : tuple

The dubins path, i.e. the angle of the first turn, the angle of the last turn, and the length of the straight segment.

straight : bool

True, to indicate that this path contains a straight segment.

lsr(start, end, center_0, center_2)[source]

Left-Straight-Right trajectories. Because of the change in turn direction, it is a little more complex to compute than in the RSR or LSL cases. First computes the poisition of the centers of the turns, and then uses the rectangle triangle defined by the point between the two circles, the center point of one circle and the tangeancy point of this circle to compute the straight segment distance.

img/twoturnsopposite.svg
Parameters:
start : tuple

(x, y, psi) coordinates of the inital point.

end : tuple

(x, y, psi) coordinates of the final point.

center_0 : tuple

(x, y) coordinates of the center of the first turn.

center_2 : tuple

(x, y) coordinates of the center of the last turn.

Returns:
total_len : float

The total distance of this path.

(beta_0, beta_2, straight_dist) : tuple

The dubins path, i.e. the angle of the first turn, the angle of the last turn, and the length of the straight segment.

straight : bool

True, to indicate that this path contains a straight segment.

rlr(start, end, center_0, center_2)[source]

Right-left-right trajectories. Using the isocele triangle made by the centers of the three circles, computes the required angles.

img/threeturns.svg
Parameters:
start : tuple

(x, y, psi) coordinates of the inital point.

end : tuple

(x, y, psi) coordinates of the final point.

center_0 : tuple

(x, y) coordinates of the center of the first turn.

center_2 : tuple

(x, y) coordinates of the center of the last turn.

Returns:
total_len : float

The total distance of this path.

(beta_0, beta_2, straight_dist) : tuple

The dubins path, i.e. the angle of the first turn, the angle of the last turn, and the length of the straight segment.

straight : bool

False, to indicate that this path does not contain a straight part.

rsl(start, end, center_0, center_2)[source]

Right-Straight-Left trajectories. Because of the change in turn direction, it is a little more complex to compute than in the RSR or LSL cases. First computes the position of the centers of the turns, and then uses the rectangle triangle defined by the point between the two circles, the center point of one circle and the tangeancy point of this circle to compute the straight segment distance.

img/twoturnsopposite.svg
Parameters:
start : tuple

(x, y, psi) coordinates of the inital point.

end : tuple

(x, y, psi) coordinates of the final point.

center_0 : tuple

(x, y) coordinates of the center of the first turn.

center_2 : tuple

(x, y) coordinates of the center of the last turn.

Returns:
total_len : float

The total distance of this path.

(beta_0, beta_2, straight_dist) : tuple

The dubins path, i.e. the angle of the first turn, the angle of the last turn, and the length of the straight segment.

straight : bool

True, to indicate that this path contains a straight segment.

rsr(start, end, center_0, center_2)[source]

Right-Straight-Right trajectories. First computes the poisition of the centers of the turns, and then uses the fact that the vector defined by the distance between the centers gives the direction and distance of the straight segment.

img/twoturnssame.svg
Parameters:
start : tuple

(x, y, psi) coordinates of the inital point.

end : tuple

(x, y, psi) coordinates of the final point.

center_0 : tuple

(x, y) coordinates of the center of the first turn.

center_2 : tuple

(x, y) coordinates of the center of the last turn.

Returns:
total_len : float

The total distance of this path.

(beta_0, beta_2, straight_dist) : tuple

The dubins path, i.e. the angle of the first turn, the angle of the last turn, and the length of the straight segment.

straight : bool

True, to indicate that this path contains a straight segment.

dubins.dist(pt_a, pt_b)[source]

Euclidian distance between two (x, y) points

dubins.ortho(vect2d)[source]

Computes an orthogonal vector to the one given