Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
waypoints.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Felix Ruess <felix.ruess@gmail.com>
3 *
4 * This file is part of paparazzi.
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
26#ifndef WAYPOINTS_H
27#define WAYPOINTS_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "std.h"
36
37#define WP_FLAG_GLOBAL 0
38#define WP_FLAG_ENU_I 1
39#define WP_FLAG_ENU_F 2
40#define WP_FLAG_LLA_I 3
41
48
49extern const uint8_t nb_waypoint;
51extern struct Waypoint waypoints[];
52
53/* aliases for backwards compatibilty */
54#define WaypointX(_wp) waypoint_get_x(_wp)
55#define WaypointY(_wp) waypoint_get_y(_wp)
56#if USE_ALT_LLA_WAYPOINTS
57#define WaypointAlt(_wp) waypoint_get_lla_alt(_wp)
58#else
59#define WaypointAlt(_wp) waypoint_get_alt(_wp)
60#endif
61#define Height(_h) (_h)
62
63extern void waypoints_init(void);
64
65extern bool waypoint_is_global(uint8_t wp_id);
66extern void waypoint_set_global_flag(uint8_t wp_id);
67extern void waypoint_clear_global_flag(uint8_t wp_id);
68
69
70/*
71 * Get waypoint coordinates.
72 */
74extern float waypoint_get_x(uint8_t wp_id);
76extern float waypoint_get_y(uint8_t wp_id);
78extern float waypoint_get_alt(uint8_t wp_id);
79extern float waypoint_get_lla_alt(uint8_t wp_id);
81extern float waypoint_get_lat_deg(uint8_t wp_id);
83extern float waypoint_get_lat_rad(uint8_t wp_id);
85extern float waypoint_get_lon_deg(uint8_t wp_id);
87extern float waypoint_get_lon_rad(uint8_t wp_id);
88
96extern struct LlaCoor_i *waypoint_get_lla(uint8_t wp_id);
97
102extern struct EnuCoor_f *waypoint_get_enu_f(uint8_t wp_id);
103
108extern struct EnuCoor_i *waypoint_get_enu_i(uint8_t wp_id);
109
110/*
111 * Set waypoint coordinates.
112 */
114extern void waypoint_set_enu(uint8_t wp_id, struct EnuCoor_f *enu);
116extern void waypoint_set_alt(uint8_t wp_id, float alt);
117
119extern void waypoint_set_here(uint8_t wp_id);
121extern void waypoint_set_here_2d(uint8_t wp_id);
122
123/* functions to set fixedpoint representation directly */
124extern void waypoint_set_enu_i(uint8_t wp_id, struct EnuCoor_i *enu);
125extern void waypoint_set_xy_i(uint8_t wp_id, int32_t x, int32_t y);
126extern void waypoint_set_alt_i(uint8_t wp_id, int32_t alt);
127extern void waypoint_set_lla(uint8_t wp_id, struct LlaCoor_i *lla);
128
130extern void waypoint_set_latlon(uint8_t wp_id, struct LlaCoor_i *lla);
131
135
136
137/*
138 * Move waypoints.
139 * Basically sets the coordinates and sends the WP_MOVED telemetry message as ack.
140 */
141extern void waypoint_move_here_2d(uint8_t wp_id);
142extern void waypoint_move_enu_i(uint8_t wp_id, struct EnuCoor_i *new_pos);
143extern void waypoint_move_xy_i(uint8_t wp_id, int32_t x, int32_t y);
144extern void waypoint_move_lla(uint8_t wp_id, struct LlaCoor_i *lla);
145
146
147/*
148 * Global(LLA) / Local(ENU) conversions.
149 */
150
152extern void waypoint_globalize(uint8_t wp_id);
153
155extern void waypoint_localize(uint8_t wp_id);
157extern void waypoints_localize_all(void);
158
159#ifdef __cplusplus
160}
161#endif
162
163#endif /* WAYPOINTS_H */
int32_t y
North.
int32_t x
East.
vector in East North Up coordinates
vector in Latitude, Longitude and Altitude
uint16_t foo
Definition main_demo5.c:58
void waypoint_copy(uint8_t wp_dest, uint8_t wp_src)
copy one waypoint to another, this includes all flags from the source waypoint
Definition waypoints.c:413
void waypoint_globalize(uint8_t wp_id)
update global LLA coordinates from its ENU coordinates
Definition waypoints.c:329
struct LlaCoor_i lla
Definition waypoints.h:46
void waypoint_set_here_2d(uint8_t wp_id)
set waypoint to current horizontal location without modifying altitude
Definition waypoints.c:298
struct Waypoint waypoints[]
size == nb_waypoint, waypoint 0 is a dummy waypoint
Definition common_nav.c:44
void waypoints_localize_all(void)
update local ENU coordinates of all global waypoints
Definition waypoints.c:357
void waypoint_position_copy(uint8_t wp_dest, uint8_t wp_src)
Definition waypoints.c:420
struct EnuCoor_i * waypoint_get_enu_i(uint8_t wp_id)
Get ENU coordinates (integer)
Definition waypoints.c:400
struct LlaCoor_i * waypoint_get_lla(uint8_t wp_id)
Get LLA coordinates of waypoint.
Definition waypoints.c:374
void waypoint_move_xy_i(uint8_t wp_id, int32_t x, int32_t y)
Definition waypoints.c:214
bool waypoint_is_global(uint8_t wp_id)
Definition waypoints.c:75
float waypoint_get_lon_rad(uint8_t wp_id)
Get longitude of waypoint in rad.
Definition waypoints.c:160
float waypoint_get_alt(uint8_t wp_id)
Get altitude of waypoint in meters (above reference)
Definition waypoints.c:113
float waypoint_get_x(uint8_t wp_id)
Get X/East coordinate of waypoint in meters.
Definition waypoints.c:97
struct EnuCoor_f * waypoint_get_enu_f(uint8_t wp_id)
Get ENU coordinates (float)
Definition waypoints.c:387
void waypoint_set_xy_i(uint8_t wp_id, int32_t x, int32_t y)
Set only local XY coordinates of waypoint without update altitude.
Definition waypoints.c:202
void waypoint_set_here(uint8_t wp_id)
set waypoint to current location and altitude
Definition waypoints.c:285
float waypoint_get_lon_deg(uint8_t wp_id)
Get longitude of waypoint in deg.
Definition waypoints.c:147
void waypoint_set_global_flag(uint8_t wp_id)
Definition waypoints.c:83
uint8_t flags
bitmask encoding valid representations and if local or global
Definition waypoints.h:43
void waypoint_set_latlon(uint8_t wp_id, struct LlaCoor_i *lla)
set waypoint latitude/longitude without updating altitude
Definition waypoints.c:273
void waypoints_init(void)
initialize global and local waypoints
Definition waypoints.c:51
struct EnuCoor_i enu_i
with INT32_POS_FRAC
Definition waypoints.h:44
float waypoint_get_lla_alt(uint8_t wp_id)
Definition waypoints.c:121
float waypoint_get_lat_deg(uint8_t wp_id)
Get latitude of waypoint in deg.
Definition waypoints.c:129
void waypoint_move_enu_i(uint8_t wp_id, struct EnuCoor_i *new_pos)
Definition waypoints.c:189
struct EnuCoor_f enu_f
Definition waypoints.h:45
float waypoint_get_y(uint8_t wp_id)
Get Y/North coordinate of waypoint in meters.
Definition waypoints.c:105
const uint8_t nb_waypoint
Definition common_nav.c:43
void waypoint_set_enu_i(uint8_t wp_id, struct EnuCoor_i *enu)
Definition waypoints.c:165
void waypoint_clear_global_flag(uint8_t wp_id)
Definition waypoints.c:90
void waypoint_set_lla(uint8_t wp_id, struct LlaCoor_i *lla)
Definition waypoints.c:243
void waypoint_set_alt_i(uint8_t wp_id, int32_t alt)
Definition waypoints.c:223
void waypoint_move_here_2d(uint8_t wp_id)
Definition waypoints.c:310
void waypoint_localize(uint8_t wp_id)
update local ENU coordinates from its LLA coordinates
Definition waypoints.c:340
void waypoint_set_alt(uint8_t wp_id, float alt)
Set altitude of waypoint in meters (above reference)
Definition waypoints.c:233
void waypoint_move_lla(uint8_t wp_id, struct LlaCoor_i *lla)
Definition waypoints.c:253
float waypoint_get_lat_rad(uint8_t wp_id)
Get latitude of waypoint in rad.
Definition waypoints.c:142
void waypoint_set_enu(uint8_t wp_id, struct EnuCoor_f *enu)
Set local ENU waypoint coordinates.
Definition waypoints.c:177
Paparazzi floating point math for geodetic calculations.
vector in East North Up coordinates Units: meters
Paparazzi fixed point math for geodetic calculations.
int int32_t
Typedef defining 32 bit int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.