The followed position and attitude at time t, in the parent's
coordinates (from the data frame's, if follow had one, by both
frames' poses at time t); pos and att unchanged where nothing is
followed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ReferenceFrame), | intent(in) | :: | self | |||
| real(kind=wp), | intent(in) | :: | t |
simulation time |
||
| real(kind=wp), | intent(inout) | :: | pos(3) |
the pose (in the parent's coordinates) |
||
| real(kind=wp), | intent(inout) | :: | att(4) |
the pose (in the parent's coordinates) |
recursive subroutine followed_pose(self, t, pos, att) class(ReferenceFrame), intent(in) :: self real(wp), intent(in) :: t !! simulation time real(wp), intent(inout) :: pos(3), att(4) !! the pose (in the parent's coordinates) real(wp) :: m(4,4), p(3), q(4) logical :: has_position, has_attitude p = pos q = att call self%follower_%state_at(t, p, q, has_position, has_attitude) if (.not. (has_position .or. has_attitude)) return if (associated(self%follow_frame_)) then ! the data frame's coordinates to the parent's, at t m = self%follow_frame_%world_matrix_at(t) if (self%n_parents > 0) m = matmul(rigid_inverse(self%parents(1)%p%world_matrix_at(t)), m) if (has_position) p = matmul(m(1:3, 1:3), p) + m(1:3, 4) if (has_attitude) q = quat_normalize(quat_multiply(quat_from_matrix(m(1:3, 1:3)), q)) end if if (has_position) pos = p if (has_attitude) att = q end subroutine followed_pose