34 #ifndef TARGET_POS_TIMEOUT
35 #define TARGET_POS_TIMEOUT 5000
39 #ifndef TARGET_RTK_TIMEOUT
40 #define TARGET_RTK_TIMEOUT 1000
43 #ifndef TARGET_OFFSET_HEADING
44 #define TARGET_OFFSET_HEADING 180.0
47 #ifndef TARGET_OFFSET_DISTANCE
48 #define TARGET_OFFSET_DISTANCE 12.0
51 #ifndef TARGET_OFFSET_HEIGHT
52 #define TARGET_OFFSET_HEIGHT -1.2
55 #ifndef TARGET_INTEGRATE_XY
56 #define TARGET_INTEGRATE_XY true
59 #ifndef TARGET_INTEGRATE_Z
60 #define TARGET_INTEGRATE_Z false
81 #if PERIODIC_TELEMETRY
85 pprz_msg_send_TARGET_POS_INFO(trans,
dev, AC_ID,
101 #if PERIODIC_TELEMETRY
110 uint32_t stamp __attribute__((unused)),
123 if(DL_TARGET_POS_ac_id(buf) != AC_ID)
147 struct NedCoor_i target_pos_cm, drone_pos_cm;
155 pos->
x = (target_pos_cm.
x - drone_pos_cm.
x) * 0.01;
156 pos->
y = (target_pos_cm.
y - drone_pos_cm.
y) * 0.01;
157 pos->
z = (target_pos_cm.
z - drone_pos_cm.
z) * 0.01;
169 pos->
x = pos->
x + vel.
x * time_diff;
170 pos->
y = pos->
y + vel.
y * time_diff;
174 pos->
z = pos->
z + vel.
z * time_diff;
219 pos.
x = target_pos_cm.
x * 0.01;
220 pos.
y = target_pos_cm.
y * 0.01;
221 pos.
z = target_pos_cm.
z * 0.01;
Main include for ABI (AirBorneInterface).
#define ABI_BROADCAST
Broadcast address.
Event structure to store callbacks in a linked list.
uint32_t get_sys_time_msec(void)
Get the time in milliseconds since startup.
uint32_t gps_tow_from_sys_ticks(uint32_t sys_ticks)
Convert time in sys_time ticks to GPS time of week.
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
data structure for GPS information
int32_t lat
in degrees*1e7
int32_t alt
in millimeters above WGS84 reference ellipsoid
int32_t lon
in degrees*1e7
void ned_of_lla_point_i(struct NedCoor_i *ned, struct LtpDef_i *def, struct LlaCoor_i *lla)
Convert a point from LLA to local NED.
vector in North East Down coordinates
struct LtpDef_i ned_origin_i
Definition of the local (flat earth) coordinate system.
bool ned_initialized_i
true if local int coordinate frame is initialsed
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
vector in North East Down coordinates Units: meters
static const struct usb_device_descriptor dev
volatile uint32_t nb_tick
SYS_TIME_TICKS since startup.
bool target_get_pos(struct NedCoor_f *pos, float *heading)
Get the current target position (NED) and heading.
static void gps_cb(uint8_t sender_id, uint32_t stamp, struct GpsState *gps_s)
#define TARGET_OFFSET_HEIGHT
void target_parse_target_pos(uint8_t *buf)
Receive a TARGET_POS message from the ground.
static void send_target_pos_info(struct transport_tx *trans, struct link_device *dev)
#define TARGET_OFFSET_HEADING
#define TARGET_POS_TIMEOUT
#define TARGET_INTEGRATE_Z
#define TARGET_OFFSET_DISTANCE
#define TARGET_INTEGRATE_XY
void target_pos_init(void)
#define TARGET_RTK_TIMEOUT
bool target_get_vel(struct NedCoor_f *vel)
Get the current target velocity (NED)
bool target_pos_set_current_offset(float unk)
Set the current measured distance and heading as offset.
float height
Target offset height.
float course
Ground course of the target [deg].
uint32_t recv_time
Time of when the target position message was received [msec].
float ground_speed
Ground speed of the target [m/s].
float heading
Target offset heading.
struct LlaCoor_i lla
Lat, lon and altitude position of the target.
struct target_pos_t pos
The target position message.
float distance
Target offset distance.
uint32_t tow
Time of week of the target position measurement.
bool integrate_z
Enable integration of the position in Z (Up) frame.
float climb
Climb speed, z-up [m/s].
struct LlaCoor_i gps_lla
GPS LLA position.
struct target_offset_t offset
The target offset relative to ground heading.
bool valid
If the data of the target position is valid.
uint32_t target_pos_timeout
Ground target position message timeout [msec].
bool integrate_xy
Enable integration of the position in X-Y (North/East) frame.
float heading
Heading of the target [deg].
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.