Trajectory

Trajectory

new Trajectory(parameters)

Description:
  • Implements a trajectory generator on a symboling space.

    Trajectory parameters

    General parameter

    • type: ... The type element used to calculate the distance, mandatory, default is "value".
    • epsilon: ... The minimal distance between to indistinguishable value, default is near, i.e., 1e-12.
      • If d(current, goal) < epsilon the goal is supposed to be reached.
      • If d(current, obstacle) < epsilon the obstacle is supposed to be hit, generating an error.
    • step: ... The neighborhood minimal weighted distance to an obstacle, default is 1.
    • d_max: ... The maximal distance for extrapolation away from obstacle, default is no bound.
    • nu_max: ... The maximal deviation from a geodesic regarding extrapolation, default is no bound.
    • bounds_count: ... The maximal number of bounds to take into account for extrapolation, default is 0 (i.e., all bounds).
    • w_max: ... The maximal repulsion weight to avoid an obstacle, default is 1/near, i.e., 1e+12.
    • points: Optionaly defines trajectory weighted points calling the add() method.
    • verbose: ... If true print the trajectory steps on stdout. Default is false.
Parameters:
Name Type Description
parameters JSON | String

The trajectory parameters.

Methods

getParameters() → {JSON}

Description:
  • Returns the trajectory parameters.

Returns:

The trajectory parameters.

Type
JSON

setParameters(parameters) → {Trajectory}

Description:
  • Modifies some Trajectory parameters.

    • All parameters but the type can be modified.
    • The Trajectory points are preserved when changing the parameters, thus using the points field simply adds the points.
Parameters:
Name Type Description
parameters JSON

The Trajectory parameters.

Returns:

This value allowing to chain methods.

Type
Trajectory

addPoint(value, weight) → {Trajectory}

Description:
  • Adds/Erases a punctual goal or a constraint for this trajectory.

Parameters:
Name Type Description
value Value

A goal or constraint to add, as punctual value.

weight double

The element weight or relative reward.

  • > 0 If the point belongs to a goal. The highest the value, the more the goal importance.
  • < 0 If the point belongs to a constraint or obstacle to avoid.
  • = 0 If the point is to be deleted.
Returns:

This value allowing to chain add methods.

Type
Trajectory

addRegion(value, weight) → {Trajectory}

Description:
  • Adds/Erases a regaion goal or a constraint for this trajectory.

Parameters:
Name Type Description
value Type

A goal or constraint to add, as a region defined by a type.

  • By contract a Type is remament, i.e., it is NOT deleted during the program execution.
weight double

The element weight or relative reward.

  • > 0 If the point belongs to a goal. The highest the value, the more the goal importance.
  • < 0 If the point belongs to a constraint or obstacle to avoid.
  • = 0 If the point is to be deleted.
Returns:

This value allowing to chain add methods.

Type
Trajectory

add(values) → {Trajectory}

Description:
  • Adds all values of a scalar field on this one.

Parameters:
Name Type Description
values JSON | String

The trajectory points values.

  • The trajectory points's type must be compatible (i.e., the same type or a derived type) of this scalar value type.
  • It can also be defined as a JSON unordered list of value of syntax:
[
  { input: ... output: ... }
  ../..
]

where input stands for the trajectory point, and output for the related weight.

Returns:

This value allowing to chain add methods.

Type
Trajectory

getNext(currentopt) → {Value}

Description:
  • Gets the next point on the trajectory.

Parameters:
Name Type Attributes Description
current JSON | String <optional>

The actual state value.

  • If omitted considers the previous returned value.
  • If specified then reset the trajectory.
Throws:

An illegal-argument exception if at the beginning the value was already on a obstacle.

Returns:

The next value on the trajectory towards a goal, avoiding obstacles. Returns the current value if already on a goal.

Type
Value

isDone() → {bool}

Description:
  • Checks if a goal has been attained.

Returns:

True if the last current value obtained by getNext() is on a goal.

Type
bool

getPath(currentopt, max_pathopt) → {Value}

Description:
  • Gets the path from the current state to a goal.

    • Parameters can also be specified via the ScalarField "current", "max_path" parameters.
Parameters:
Name Type Attributes Default Description
current JSON | String <optional>

The actual state value.

  • If omitted considers the previous returned value.
  • If specified then reset the trajectory.
max_path unit <optional>
0

The maximal path length, default is 0 (no bound);

Throws:

An illegal-argument exception if at the beginning the value was already on a obstacle.

Returns:

The path sequence of the trajectory towards a goal, avoiding obstacles.

Type
Value