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) |
subroutine state_at(self, sim_time, position, attitude, has_position, has_attitude, time, chosen) class(TrajectoryFollower), intent(in) :: self real(wp), intent(in) :: sim_time !! simulation time (s) real(wp), intent(inout) :: position(3) !! the followed position (in the trajectories' frame; unchanged if none) real(wp), intent(inout) :: attitude(4) !! the followed attitude (quaternion [x, y, z, w]; unchanged if none) logical, intent(out) :: has_position, has_attitude !! (true: position / attitude set) real(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) type(Trajectory), pointer :: traj real(wp) :: t integer :: status, i, k has_position = .false. has_attitude = .false. if (present(time)) time = 0.0_wp if (present(chosen)) chosen = 0 if (self%n == 0) return if (self%follow_time) then t = sim_time + self%time_value else t = self%time_value end if t = wrapped_time(self, t) k = chosen_trajectory(self, t) if (present(time)) time = t if (present(chosen)) chosen = k traj => self%trajs(k)%p status = traj%time_index(t, i) ! (once, for the position and the attitude) if (iand(self%data_, FOLLOW_POSITION) /= 0 .and. self%data_valid()) & call interpolate_position(traj, self%sources_, t, status, i, position, has_position) if (iand(self%data_, FOLLOW_ATTITUDE) /= 0) & call interpolate_attitude(traj, t, status, i, attitude, has_attitude) end subroutine state_at