Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
c-astral-wrapper
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
c-astral-wrapper
Commits
703fa7f8
Commit
703fa7f8
authored
Aug 29, 2023
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop relying on gps messages
Use position messages instead of gps ones in case of gps denial.
parent
40a276a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
mavsdk_wrapper.cpp
mavsdk_wrapper.cpp
+11
-10
No files found.
mavsdk_wrapper.cpp
View file @
703fa7f8
...
@@ -43,7 +43,6 @@ static const double COS_ADDED_DISTANCE = cos(ADDED_DISTANCE);
...
@@ -43,7 +43,6 @@ static const double COS_ADDED_DISTANCE = cos(ADDED_DISTANCE);
static
const
double
SIN_ADDED_DISTANCE
=
sin
(
ADDED_DISTANCE
);
static
const
double
SIN_ADDED_DISTANCE
=
sin
(
ADDED_DISTANCE
);
static
int
mavsdk_started
=
0
;
static
int
mavsdk_started
=
0
;
static
uint64_t
init_timestamp
;
static
Telemetry
::
Position
origin
;
static
Telemetry
::
Position
origin
;
static
Coordinates
targeted_destination
;
static
Coordinates
targeted_destination
;
...
@@ -169,19 +168,22 @@ static void updateProjection(double current_lat, double current_lon) {
...
@@ -169,19 +168,22 @@ static void updateProjection(double current_lat, double current_lon) {
int
updateLogAndProjection
(
void
)
{
int
updateLogAndProjection
(
void
)
{
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
Telemetry
::
RawGps
gps
;
Telemetry
::
Position
position
;
Telemetry
::
FixedwingMetrics
metrics
;
if
(
mavsdk_started
)
{
if
(
mavsdk_started
)
{
gps
=
telemetry
->
raw_gps
();
const
auto
now
=
std
::
chrono
::
system_clock
::
now
();
oss
<<
(
gps
.
timestamp_us
-
init_timestamp
)
/
1000
<<
";"
position
=
telemetry
->
position
();
<<
gps
.
latitude_deg
<<
";"
<<
gps
.
longitude_deg
<<
";"
metrics
=
telemetry
->
fixedwing_metrics
();
<<
gps
.
absolute_altitude_m
<<
";"
<<
telemetry
->
position
().
relative_altitude_m
<<
";"
oss
<<
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
now
.
time_since_epoch
()).
count
()
<<
";"
<<
position
.
latitude_deg
<<
";"
<<
position
.
longitude_deg
<<
";"
<<
position
.
absolute_altitude_m
<<
";"
<<
position
.
relative_altitude_m
<<
";"
<<
telemetry
->
attitude_euler
().
yaw_deg
<<
";"
<<
telemetry
->
attitude_euler
().
yaw_deg
<<
";"
<<
gps
.
velocity_m_s
<<
";"
<<
telemetry
->
fixedwing_metrics
()
.
climb_rate_m_s
;
<<
metrics
.
velocity_m_s
<<
";"
<<
metrics
.
climb_rate_m_s
;
log
(
oss
.
str
());
log
(
oss
.
str
());
if
(
projected_destination
.
latitude
!=
0
||
targeted_destination
.
latitude
!=
0
)
{
if
(
projected_destination
.
latitude
!=
0
||
targeted_destination
.
latitude
!=
0
)
{
return
updateProjection
(
gps
.
latitude_deg
,
gps
.
longitude_deg
);
return
updateProjection
(
position
.
latitude_deg
,
position
.
longitude_deg
);
}
}
}
}
...
@@ -234,11 +236,10 @@ int start(const char * ip, int port, const char * log_file, int timeout) {
...
@@ -234,11 +236,10 @@ int start(const char * ip, int port, const char * log_file, int timeout) {
}
while
(
isnan
(
abs_altitude
)
||
abs_altitude
==
0
);
}
while
(
isnan
(
abs_altitude
)
||
abs_altitude
==
0
);
origin
=
telemetry
->
position
();
origin
=
telemetry
->
position
();
init_timestamp
=
telemetry
->
raw_gps
().
timestamp_us
;
log
(
"MAVSDK started..."
);
log
(
"MAVSDK started..."
);
mavsdk_started
=
1
;
mavsdk_started
=
1
;
log
(
"timestamp (ms);latitude (°);longitude (°);AMSL (m);rel altitude (m);yaw (°);
ground
speed (m/s);climb rate (m/s)"
);
log
(
"timestamp (ms);latitude (°);longitude (°);AMSL (m);rel altitude (m);yaw (°);
air
speed (m/s);climb rate (m/s)"
);
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment