Following trajectories: the position and attitude of a frame from one or more trajectories at the current time, as OpenFrames' TrajectoryFollower.
With several trajectories, the one followed at time t is the one whose time range contains t, or the closest one. If t is outside all of them, FOLLOW_LOOP wraps it into their combined time range and FOLLOW_LIMIT holds the ends. Positions are interpolated linearly, attitudes by slerp.
The time is either the global simulation time plus an offset (set_offset_time, the default with offset 0) or a fixed time (set_time). The trajectories are not owned: they must stay alive while followed.
state_at gives the followed state at any time without changing the follower (for frames' poses at points' own times: vkf_frames' world_matrix_at); update is state_at at the simulation time. Every change to what is followed and how stamps the follower (motion_stamp, from next_motion_stamp's clock), so that drawings depending on its motion know to redraw.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | FOLLOW_ATTITUDE | = | 2 |
follow the attitude |
| integer, | public, | parameter | :: | FOLLOW_LIMIT | = | 1 |
hold the first/last point outside the time range |
| integer, | public, | parameter | :: | FOLLOW_LOOP | = | 0 |
follow modes (OpenFrames' FollowMode) wrap the time into the trajectories' time range |
| integer, | public, | parameter | :: | FOLLOW_POSITION | = | 1 |
what to follow (OpenFrames' FollowData), combined with ior follow the position |
| integer, | private, | save | :: | motion_clock | = | 0 |
The clock of motion stamps (next_motion_stamp). |
Follows trajectories (see the module documentation).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | current | = | 0 |
index (in trajs) of the trajectory last followed |
|
| integer, | private | :: | data_ | = | FOLLOW_POSITION+FOLLOW_ATTITUDE |
what is followed (FOLLOW_* combined with ior) |
|
| logical, | private | :: | default_data | = | .true. |
(true: sources_ are the trajectories' positions) |
|
| logical, | private | :: | follow_time | = | .true. |
(true: simulation time + time_value; false: time_value) |
|
| real(kind=wp), | private | :: | last_time_ | = | 0.0_wp |
time (after looping) at the last update (s) |
|
| integer, | private | :: | mode_ | = | FOLLOW_LOOP |
FOLLOW_LOOP or FOLLOW_LIMIT |
|
| integer, | private | :: | n | = | 0 |
number of followed trajectories |
|
| type(DataSource), | private | :: | sources_(3) |
where the followed position's x, y, z come from |
|||
| integer, | private | :: | stamp_ | = | 0 |
motion stamp of the last change of settings (next_motion_stamp) |
|
| real(kind=wp), | private | :: | time_value | = | 0.0_wp |
time offset or fixed time (s) |
|
| type(TrajectoryPointer), | private, | allocatable | :: | trajs(:) |
(capacity): the followed trajectories |
| procedure, public :: add_trajectory | |
| procedure, public :: data_revision | |
| procedure, public :: data_sources | |
| procedure, public :: data_valid | |
| procedure, public :: follow_data | |
| procedure, public :: follow_mode | |
| procedure, public :: is_following_time | |
| procedure, public :: last_time | |
| procedure, public :: last_trajectory | |
| procedure, public :: motion_stamp | |
| procedure, public :: num_trajectories | |
| procedure, public :: remove_all | |
| procedure, public :: remove_trajectory | |
| procedure, public :: set_default_data | |
| procedure, public :: set_follow_type | |
| procedure, public :: set_offset_time | |
| procedure, public :: set_time | |
| procedure, public :: set_trajectory | |
| procedure, public :: set_x_data | |
| procedure, public :: set_y_data | |
| procedure, public :: set_z_data | |
| procedure, public :: state_at | |
| procedure, public :: update | |
| procedure, public :: using_default_data |
A pointer to a followed trajectory (for an array of them).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(Trajectory), | public, | pointer | :: | p | => | null() |
the trajectory (not owned) |
The trajectory to follow at time t: the current one if it contains t, else the first that does, else the closest.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(TrajectoryFollower), | intent(in) | :: | self | |||
| real(kind=wp), | intent(in) | :: | t |
the time (s) |
The sum of the followed trajectories' revisions and generations: it grows with any change to their data (the set of trajectories itself changes the motion_stamp).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(in) | :: | self |
Where the followed position's x, y and z come from.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(in) | :: | self |
True if every followed trajectory has the data the position sources use.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(in) | :: | self |
What is followed: FOLLOW_POSITION and/or FOLLOW_ATTITUDE (combined with ior).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(in) | :: | self |
How time outside the trajectories is handled: FOLLOW_LOOP or FOLLOW_LIMIT.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(in) | :: | self |
True if following the simulation time plus an offset, false for a fixed time.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(in) | :: | self |
The time (after looping) at the last update.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(in) | :: | self |
The trajectory followed at the last update (null if none).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(in) | :: | self |
The stamp of the last change of the follower's settings (the trajectories followed, what and how, the time); 0 if never changed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(in) | :: | self |
A new motion stamp: larger than all before (a change of some frame's motion: its pose, its parents, what it follows and how).
Number of trajectories followed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(in) | :: | self |
Where the x, y and z of the followed position come from (default: the trajectories' positions). Returns whether all followed trajectories have those data.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(inout) | :: | self | |||
| type(DataSource), | intent(in) | :: | src |
where the x comes from |
Where the y of the followed position comes from (see set_x_data).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(inout) | :: | self | |||
| type(DataSource), | intent(in) | :: | src |
where the y comes from |
Where the z of the followed position comes from (see set_x_data).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(inout) | :: | self | |||
| type(DataSource), | intent(in) | :: | src |
where the z comes from |
True if the followed position is the trajectories' positions (set_default_data).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(in) | :: | self |
For FOLLOW_LOOP, t wrapped into the combined time range of the trajectories.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(TrajectoryFollower), | intent(in) | :: | self | |||
| real(kind=wp), | intent(in) | :: | t |
the time (s) |
Also follow traj (no effect if it is already followed).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(inout) | :: | self | |||
| type(Trajectory), | intent(in), | pointer | :: | traj |
the trajectory to add (not owned; null: none) |
Slerp of the attitude at time t; the first/last attitude outside the time
range. status and index: the trajectory's time_index for t.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(Trajectory), | intent(in) | :: | traj |
the trajectory |
||
| real(kind=wp), | intent(in) | :: | t |
the time (s) |
||
| integer, | intent(in) | :: | status |
traj%time_index's result and index for t |
||
| integer, | intent(in) | :: | index |
traj%time_index's result and index for t |
||
| real(kind=wp), | intent(inout) | :: | attitude(4) |
quaternion [x, y, z, w] |
||
| logical, | intent(out) | :: | ok |
false if there is no attitude (attitude unchanged) |
Linear interpolation of the position (from sources) at time t; the
first/last point outside the time range. status and index: the
trajectory's time_index for t.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(Trajectory), | intent(in) | :: | traj |
the trajectory |
||
| type(DataSource), | intent(in) | :: | sources(3) |
where the position's x, y, z come from |
||
| real(kind=wp), | intent(in) | :: | t |
the time (s) |
||
| integer, | intent(in) | :: | status |
traj%time_index's result and index for t |
||
| integer, | intent(in) | :: | index |
traj%time_index's result and index for t |
||
| real(kind=wp), | intent(inout) | :: | position(3) |
the interpolated position |
||
| logical, | intent(out) | :: | ok |
false if there is no position (position unchanged) |
Stop following all trajectories.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(inout) | :: | self |
Stop following traj.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(inout) | :: | self | |||
| type(Trajectory), | intent(in), | pointer | :: | traj |
the trajectory to stop following |
Use the trajectories' positions (per the first trajectory's DOF).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(inout) | :: | self |
What to follow (FOLLOW_POSITION and/or FOLLOW_ATTITUDE, combined with ior) and how (FOLLOW_LOOP or FOLLOW_LIMIT).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | data |
FOLLOW_POSITION and/or FOLLOW_ATTITUDE (ior) |
||
| integer, | intent(in) | :: | mode |
FOLLOW_LOOP or FOLLOW_LIMIT |
Follow at the simulation time plus offset (the default, offset 0).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | offset |
added to the simulation time (s) |
Follow at a fixed time (independent of the simulation time).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | t |
the time (s) |
Follow only traj (none if it is not associated).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(inout) | :: | self | |||
| type(Trajectory), | intent(in), | pointer | :: | traj |
the trajectory to follow (not owned; null: none) |
The position and attitude followed at simulation time sim_time, as
update (the same time mapping, choice of trajectory and
interpolation) but without changing the follower: for any time, e.g.
a frame's pose at a trajectory point's own time.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(in) | :: | self | |||
| real(kind=wp), | intent(in) | :: | sim_time |
simulation time (s) |
||
| real(kind=wp), | intent(inout) | :: | position(3) |
the followed position (in the trajectories' frame; unchanged if none) |
||
| real(kind=wp), | intent(inout) | :: | attitude(4) |
the followed attitude (quaternion [x, y, z, w]; unchanged if none) |
||
| logical, | intent(out) | :: | has_position |
(true: position / attitude set) |
||
| logical, | intent(out) | :: | has_attitude |
(true: position / attitude set) |
||
| real(kind=wp), | intent(out), | optional | :: | time |
the trajectories' time used (after the offset and looping) |
|
| integer, | intent(out), | optional | :: | chosen |
the trajectory used (index in the followed ones) |
The position and attitude at simulation time sim_time. has_position
and has_attitude say whether each could be computed (and is being
followed); otherwise position / attitude are left unchanged.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TrajectoryFollower), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | sim_time |
simulation time (s) |
||
| real(kind=wp), | intent(inout) | :: | position(3) |
the followed position (in the trajectories' frame) |
||
| real(kind=wp), | intent(inout) | :: | attitude(4) |
the followed attitude (quaternion [x, y, z, w]) |
||
| logical, | intent(out) | :: | has_position |
(true: position / attitude set) |
||
| logical, | intent(out) | :: | has_attitude |
(true: position / attitude set) |