UAV Simulator
Loading...
Searching...
No Matches
WaypointList Class Reference

Stores and manages a list of 3D waypoints for trajectory following or mission execution. More...

#include <waypoint_list.h>

Public Member Functions

 WaypointList ()
 
 WaypointList (const std::vector< easy3d::vec3 > &waypoints)
 Constructor to initialize the waypoint list.
 
const easy3d::vec3currentWaypoint () const
 Returns the currently active waypoint.
 
void advanceToNext ()
 Advances the pointer to the next waypoint. If already at the last waypoint, it will stay there.
 
bool missionComplete () const
 Checks whether all waypoints have been processed.
 
void draw (easy3d::Viewer &viewer) const
 Renders the waypoints in the provided Easy3D viewer.
 
const std::vector< easy3d::vec3 > & getWaypoints () const
 

Private Attributes

std::vector< easy3d::vec3waypoints_
 List of waypoints in 3D space.
 
size_t current_index_
 Index of the current active waypoint.
 

Detailed Description

Stores and manages a list of 3D waypoints for trajectory following or mission execution.

This class is responsible for holding a sequence of spatial waypoints (easy3d::vec3) and tracking progress through them. It allows you to:

  • Retrieve the current waypoint
  • Move to the next waypoint
  • Check if all waypoints are completed
  • Visualize them in an Easy3D viewer

Constructor & Destructor Documentation

◆ WaypointList() [1/2]

WaypointList::WaypointList ( )

◆ WaypointList() [2/2]

WaypointList::WaypointList ( const std::vector< easy3d::vec3 > &  waypoints)

Constructor to initialize the waypoint list.

Constructs a WaypointList with the provided set of waypoints.

Parameters
waypointsA vector of 3D coordinates representing waypoints in space.
waypointsA vector of 3D points representing the mission trajectory.

Member Function Documentation

◆ advanceToNext()

void WaypointList::advanceToNext ( )

Advances the pointer to the next waypoint. If already at the last waypoint, it will stay there.

Advances the mission to the next waypoint, if available. If the current waypoint is the last one, no change occurs.

◆ currentWaypoint()

const easy3d::vec3 & WaypointList::currentWaypoint ( ) const

Returns the currently active waypoint.

Retrieves the current active waypoint in the mission.

Returns
A constant reference to the current waypoint.
A reference to the current waypoint (as a 3D vector).

◆ draw()

void WaypointList::draw ( easy3d::Viewer &  viewer) const

Renders the waypoints in the provided Easy3D viewer.

Visualizes all waypoints in the viewer as yellow points.

Parameters
viewerReference to the Easy3D viewer for rendering the points.

This function adds a PointsDrawable to the viewer to render all mission waypoints. Each point appears with a fixed size and color.

Parameters
viewerReference to the Easy3D viewer for rendering.

◆ getWaypoints()

const std::vector< easy3d::vec3 > & WaypointList::getWaypoints ( ) const
inline

◆ missionComplete()

bool WaypointList::missionComplete ( ) const

Checks whether all waypoints have been processed.

Checks whether the mission has reached or passed the final waypoint.

Returns
True if the mission is complete (i.e., no more waypoints left).
True if the current waypoint is the last in the list; otherwise, false.

Member Data Documentation

◆ current_index_

size_t WaypointList::current_index_
private

Index of the current active waypoint.

◆ waypoints_

std::vector<easy3d::vec3> WaypointList::waypoints_
private

List of waypoints in 3D space.


The documentation for this class was generated from the following files: