Source

papl / src / PaplPair.mli

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

type 'a pair_t = 'a * 'a

(** {2 Planning spaces} *)

(** Each coordinate is interpolated independently using the same interpolation
    function.
*)

val interpolate : 'a PaplInterpolate.t -> 'a pair_t PaplInterpolate.t
(** The function [interpolate ip] interpolates pairs by interpolating each
    coordinate using [ip].
*)

(** {2 Integer pairs} *)
module Int : sig
  type t = int pair_t

  val interpolate : t PaplInterpolate.t
(** The interpolation function interpolates the coordinates as if they were
    floats and then rounds the values to the nearest integer.
*)

  val to_float : t -> float pair_t
(** Integer to float conversion for a pair.
*)

  val of_float : float pair_t -> t
(** Float to integer conversion for a pair.
*)

  val ( *: ) : int -> t -> t
(** Scalar multiplication. *)

  val (/:) : t -> int -> t
(** Division of a vector by a scalar. *)

  val (+:) : t -> t -> t
(** Vector addition. *)

  val (-:) : t -> t -> t
(** Vector subtraction. *)

  val neg : t -> t
(** Unary negation. *)

(** Metrics *)
  include PaplVectorMetric.S
    with type t := t
    and type weight_t = float pair_t
end

(** {2 Planner constraints} *)

module PlannerConstraint : sig
  val couple :
    'a PaplPlannerConstraint.t ->
    'a PaplPlannerConstraint.t ->
    'a pair_t PaplPlannerConstraint.t ->
    'a pair_t PaplPlannerConstraint.t
(** Combination of constraints for coupled planning.

    Let [A] and [B] be robots in an environment E. Let [ca] and [cb] be
    constraints for [A] in [E] and [B] in [E], and let [cab] be a constraint for
    collisions between [A] and [E].

    The constraint [c = combine ca cb cab] combines these constraints into a
    single constraint for the movement of the coupled robot [(A, B)].
*)
end