Skip to content

6. Waypoint Manager

davidcGIThub edited this page Jan 5, 2021 · 10 revisions

This page explains how to use the waypoint manager

Creating Waypoints

Waypoints are set in reference to your initial LLA position (Latitude, Longitude, Altitude). In other words, the waypoint origin is the initial LLA position of the copter in use. The dataset is configured in a 2D array, where each row defines a single waypoint as follows:

[North, East, Altitude, Heading]

Waypoints are defined in a YAML file, and by default the waypoints.yaml file is used. See example below.

waypoint_manager: {

waypoints:

[[0, 0, 1.5, 0],

[0, 1, 1.5, 1.57],

[0, -1, 1.5, -1.57]],

threshold: 0.1,

cycle: True

}

If cycle is set to True, the quadrotor will continuously cycle through the set of waypoints. The threshold parameter defines the acceptable position error for reaching a waypoint (in meters). Waypoints can also be set through ROS services defined below.

Services

Waypoints are updated through services, which are called with

rosservice call <name_of_service> <args>

Note: all waypoint services are 0 indexed.

Current waypoint services provided are as follows:

/add_waypoint

Adds a waypoint at a specified index. Arguments are: x y z index

For example, the following code adds a waypoint at the x,y,z coordinate [1, 2, 3] facing along the positive y-axis as the first waypoint:

rosservice call /add_waypoint 1 2 3 0 0

/remove_waypoint

Removes a waypoint at a specified index. Argument is index.

For example, the following code removes the first waypoint:

rosservice call /remove_waypoint 0

/set_waypoints_from_file

Replaces all current waypoints with a list from a file. Currently tested with .csv and .txt files. In each row/line of the file, include the waypoint x, y, z, and orientation (separated with commas in a .txt file). The argument is the path to the file.

For example, the following code sets the waypoints from a file called waypoints.csv:

rosservice call /set_waypoints_from_file /<path>/<to>/<file>/waypoints.csv

/list_waypoints

Lists the current waypoints in order starting from the first index. No arguments.

rosservice call /list_waypoints

/clear_waypoints

Removes all waypoints. Because the multirotor needs at least 1 waypoint to be controlled, the multirotor's position when /clear_waypoints is called is set as the waypoint.

rosservice call /clear_waypoints