follow Subroutine

private subroutine follow(self, traj, data, mode, add, data_frame)

Follow traj (in addition to trajectories already followed, if add is true), with what to follow (data: FOLLOW_POSITION and/or FOLLOW_ATTITUDE; default both) and how (mode: FOLLOW_LOOP, the default, or FOLLOW_LIMIT). traj must stay alive while followed.

The followed data are in the parent's coordinates, unless data_frame (a frame of the same tree) says which frame they are in: e.g. a spacecraft's inertial trajectory followed by a frame shown in a rotating frame, placed (and turned) by both frames' poses at each time (see world_matrix_at), so that it rides on the trajectory drawn in that frame (DrawableTrajectory's set_data_frame). data_frame must not depend on this frame (be it or one of its descendants).

call craft%follow(orbit)                                  ! position (and attitude, if any), looping
call craft%follow(orbit, data=FOLLOW_POSITION, mode=FOLLOW_LIMIT)   ! position only, held at the ends
call craft%follow(flyby, data_frame=eci)                  ! inertial data, the craft under a rotating frame

Type Bound

ReferenceFrame

Arguments

Type IntentOptional Attributes Name
class(ReferenceFrame), intent(inout) :: self
type(Trajectory), intent(in), target :: traj

the trajectory to follow (not owned)

integer, intent(in), optional :: data

FOLLOW_POSITION/FOLLOW_ATTITUDE; FOLLOW_LOOP/FOLLOW_LIMIT

integer, intent(in), optional :: mode

FOLLOW_POSITION/FOLLOW_ATTITUDE; FOLLOW_LOOP/FOLLOW_LIMIT

logical, intent(in), optional :: add

(true: in addition to those followed (default false))

class(ReferenceFrame), intent(in), optional, target :: data_frame

the frame the data are in (default: the parent)


Calls

proc~~follow~~CallsGraph proc~follow ReferenceFrame%follow proc~add_trajectory TrajectoryFollower%add_trajectory proc~follow->proc~add_trajectory proc~next_motion_stamp next_motion_stamp proc~follow->proc~next_motion_stamp proc~set_follow_type TrajectoryFollower%set_follow_type proc~follow->proc~set_follow_type proc~set_trajectory~2 TrajectoryFollower%set_trajectory proc~follow->proc~set_trajectory~2 proc~add_trajectory->proc~next_motion_stamp proc~set_default_data TrajectoryFollower%set_default_data proc~add_trajectory->proc~set_default_data proc~set_follow_type->proc~next_motion_stamp proc~set_trajectory~2->proc~add_trajectory proc~remove_all TrajectoryFollower%remove_all proc~set_trajectory~2->proc~remove_all proc~remove_all->proc~next_motion_stamp proc~set_default_data->proc~next_motion_stamp proc~dof Trajectory%dof proc~set_default_data->proc~dof proc~position_sources position_sources proc~set_default_data->proc~position_sources

Source Code

    subroutine follow(self, traj, data, mode, add, data_frame)
        class(ReferenceFrame), intent(inout) :: self
        type(Trajectory), intent(in), target :: traj        !! the trajectory to follow (not owned)
        integer, intent(in), optional :: data, mode         !! FOLLOW_POSITION/FOLLOW_ATTITUDE; FOLLOW_LOOP/FOLLOW_LIMIT
        logical, intent(in), optional :: add                !! (true: in addition to those followed (default false))
        class(ReferenceFrame), intent(in), target, optional :: data_frame  !! the frame the data are in (default: the parent)
        type(Trajectory), pointer :: p
        integer :: d, m
        logical :: adding
        p => traj
        adding = .false.
        if (present(add)) adding = add
        d = ior(FOLLOW_POSITION, FOLLOW_ATTITUDE)
        m = FOLLOW_LOOP
        if (present(data)) d = data
        if (present(mode)) m = mode
        if (adding) then
            call self%follower_%add_trajectory(p)
        else
            call self%follower_%set_trajectory(p)
        end if
        call self%follower_%set_follow_type(d, m)
        self%following = .true.
        self%follow_frame_ => null()
        if (present(data_frame)) self%follow_frame_ => data_frame
        self%stamp_ = next_motion_stamp()
    end subroutine follow