Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
Main Page
Related Pages
Modules
Data Structures
Data Structures
Data Structure Index
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
ctc_target.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2017 Hector Garcia de Marina
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, write to
18
* the Free Software Foundation, 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
20
*
21
*/
22
23
#include <math.h>
24
#include <
std.h
>
25
#include <stdio.h>
26
27
#include "
modules/multi/ctc/ctc_target.h
"
28
//#include "subsystems/datalink/datalink.h" // dl_buffer
29
#include "
subsystems/datalink/telemetry.h
"
30
#include "
firmwares/rotorcraft/navigation.h
"
31
#include "
autopilot.h
"
32
34
#ifndef CTC_MAX_AC
35
#define CTC_MAX_AC 4
36
#endif
37
38
int16_t
tableNei
[
CTC_MAX_AC
][6];
39
40
void
ctc_target_init
(
void
)
41
{
42
for
(
int
i = 0; i <
CTC_MAX_AC
; i++) {
43
tableNei
[i][0] = -1;
44
}
45
}
46
47
void
ctc_target_send_info_to_nei
(
void
)
48
{
49
struct
EnuCoor_f
*v =
stateGetSpeedEnu_f
();
50
struct
EnuCoor_f
*
p
=
stateGetPositionEnu_f
();
51
52
float
vx = v->
x
;
53
float
vy = v->
y
;
54
float
px =
p
->x;
55
float
py =
p
->y;
56
57
struct
pprzlink_msg
msg
;
58
59
for
(
int
i = 0; i <
CTC_MAX_AC
; i++)
60
if
(
tableNei
[i][0] != -1) {
61
msg
.trans = &(
DefaultChannel
).trans_tx;
62
msg
.dev = &(
DefaultDevice
).device;
63
msg
.sender_id = AC_ID;
64
msg
.receiver_id =
tableNei
[i][0];
65
msg
.component_id = 0;
66
pprzlink_msg_send_CTC_INFO_FROM_TARGET(&
msg
, &px, &py, &vx, &vy);
67
}
68
}
69
70
void
parse_ctc_target_RegTable
(
void
)
71
{
72
uint8_t
ac_id
= DL_CTC_REG_TABLE_ac_id(
dl_buffer
);
73
if
(
ac_id
== AC_ID) {
74
uint8_t
nei_id = DL_CTC_REG_TABLE_nei_id(
dl_buffer
);
75
for
(
int
i = 0; i <
CTC_MAX_AC
; i++)
76
if
(
tableNei
[i][0] == -1) {
77
tableNei
[i][0] = (
int16_t
)nei_id;
78
return
;
79
}
80
}
81
}
82
83
void
parse_ctc_target_CleanTable
(
void
)
84
{
85
uint8_t
ac_id
= DL_CTC_REG_TABLE_ac_id(
dl_buffer
);
86
if
(
ac_id
== AC_ID)
87
for
(
int
i = 0; i <
CTC_MAX_AC
; i++) {
88
tableNei
[i][0] = -1;
89
}
90
}
91
parse_ctc_target_RegTable
void parse_ctc_target_RegTable(void)
Definition:
ctc_target.c:70
dl_buffer
uint8_t dl_buffer[MSG_SIZE]
Definition:
main_demo5.c:64
ctc_target_init
void ctc_target_init(void)
Definition:
ctc_target.c:40
tableNei
int16_t tableNei[CTC_MAX_AC][6]
Definition:
ctc_target.c:38
ctc_target.h
stateGetPositionEnu_f
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
Definition:
state.h:719
EnuCoor_f::y
float y
in meters
Definition:
pprz_geodetic_float.h:74
msg
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
Definition:
high_speed_logger_direct_memory.c:134
telemetry.h
std.h
int16_t
signed short int16_t
Definition:
types.h:17
uint8_t
unsigned char uint8_t
Definition:
types.h:14
parse_ctc_target_CleanTable
void parse_ctc_target_CleanTable(void)
Definition:
ctc_target.c:83
EnuCoor_f
vector in East North Up coordinates Units: meters
Definition:
pprz_geodetic_float.h:72
autopilot.h
ctc_target_send_info_to_nei
void ctc_target_send_info_to_nei(void)
Definition:
ctc_target.c:47
stateGetSpeedEnu_f
static struct EnuCoor_f * stateGetSpeedEnu_f(void)
Get ground speed in local ENU coordinates (float).
Definition:
state.h:917
navigation.h
DefaultChannel
#define DefaultChannel
Definition:
downlink.h:42
EnuCoor_f::x
float x
in meters
Definition:
pprz_geodetic_float.h:73
DefaultDevice
#define DefaultDevice
Definition:
downlink.h:46
ac_id
uint8_t ac_id
Definition:
sim_ap.c:48
CTC_MAX_AC
#define CTC_MAX_AC
Definition:
ctc_target.c:35
p
static float p[2][2]
Definition:
ins_alt_float.c:268
sw
airborne
modules
multi
ctc
ctc_target.c
Generated on Tue Feb 1 2022 13:51:16 for Paparazzi UAS by
1.8.17