Source

papl / src / PaplInterpolate.mli

Full commit
(*
  Copyright (c) 2012 Anders Lau Olsen.
  See LICENSE file for terms and conditions.
*)
(**
   Planning spaces

   A motion planner searches for a path in a planning space. The type of the
   planning space is generally user defined and depends on the robot and the
   planning problem. This library does not distinguish between configuration
   space and state space planning. A member of a planning space is called a {b
   configuration} regardless of the nature of the planning.

   Planning spaces may support a number of operations discussed in modules such
   as {! PaplMetric}, {! PaplSampler}, {! PaplConstraint}, and more. The {!
   PaplInterpolate} module is concerned with the property of being able to move
   between a pair of discrete configurations. This is called {b interpolation}
   and is accomplished by a function of type {! t}.
*)

(** {2 Types} *)

type 'a t = 'a -> 'a -> float -> 'a
(** Interpolation function for a planning space.

    An interpolation function [interpolate] returns a configuration [x =
    interpolate s a b] on the path connecting [a] to [b]. The interpolation
    parameter [s] must be in the range [\[0, 1\]].
*)

type 'a intermediary_t = 'a -> 'a -> 'a BatEnum.t

val intermediary_steps :
  'a t -> 'a PaplMetric.threshold_t -> 'a intermediary_t
(** If [it = intermediary_steps ip (metric, eps)] then [it a b] are the
    intermediary steps of length [eps] connecting [a] to [b].

    [a] and [b] are not explicitly included in the stream (but they can be if
    the interpolation function [ip] happens to return them).
*)

(** {2 Float planning space} *)

(** Planning space for floats.

    Configurations are floats.

    Floats are interpolated linearly.
*)
module Float : sig
  val interpolate : float t
  val flip_interpolate : float -> float -> float -> float
end

(** {2 Int planning space} *)

module Int : sig
  val interpolate : int t
end

(** {2 Tuple planning spaces} *)

(** Planning space for tuples.

    Tuples can contain values of seperate types. Each coordinate is interpolated
    using a seperate interpolation function.
*)

module Tuple2 : sig
  val interpolate : 'a t -> 'b t -> ('a * 'b) t
end

module Tuple3 : sig
  val interpolate : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t
end

(** {2 List planning space} *)

(** Planning space for lists.

    Configurations are lists.

    Each coordinate is interpolated independently.

    The lists must be of the same length when interpolated.
*)

module List : sig
  val interpolate : 'a t -> 'a list t
end

(** {2 Array planning space} *)

(** Planning space for arrays.

    Configurations are arrays.

    Each coordinate is interpolated independently.

    Arrays being interpolated must be of the same length.
*)

module Array : sig
  val interpolate : 'a t -> 'a array t
end