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
903e38b3
Commit
903e38b3
authored
Aug 31, 2023
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add timestamp to position array
parent
0781807a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
mavsdk_wrapper.cpp
mavsdk_wrapper.cpp
+9
-2
No files found.
mavsdk_wrapper.cpp
View file @
903e38b3
...
...
@@ -170,16 +170,21 @@ static void updateProjection(double current_lat, double current_lon) {
);
}
static
long
long
int
getTimestamp
()
{
const
auto
now
=
std
::
chrono
::
system_clock
::
now
();
return
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
now
.
time_since_epoch
()).
count
();
}
int
updateLogAndProjection
(
void
)
{
std
::
ostringstream
oss
;
Telemetry
::
Position
position
;
Telemetry
::
FixedwingMetrics
metrics
;
long
long
int
timestamp
=
getTimestamp
();
if
(
mavsdk_started
)
{
const
auto
now
=
std
::
chrono
::
system_clock
::
now
();
position
=
telemetry
->
position
();
metrics
=
telemetry
->
fixedwing_metrics
();
oss
<<
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
now
.
time_since_epoch
()).
count
()
<<
";"
oss
<<
timestamp
<<
";"
<<
position
.
latitude_deg
<<
";"
<<
position
.
longitude_deg
<<
";"
<<
position
.
absolute_altitude_m
<<
";"
<<
position
.
relative_altitude_m
<<
";"
<<
telemetry
->
attitude_euler
().
yaw_deg
<<
";"
...
...
@@ -387,12 +392,14 @@ double getInitialLongitude(void) {
}
double
*
getPositionArray
(
void
)
{
double
timestamp
=
(
double
)
getTimestamp
();
Telemetry
::
Position
position
=
telemetry
->
position
();
double
*
positionArray
=
(
double
*
)
malloc
(
POSITION_ARRAY_SIZE
*
sizeof
(
double
));
positionArray
[
0
]
=
position
.
latitude_deg
;
positionArray
[
1
]
=
position
.
longitude_deg
;
positionArray
[
2
]
=
(
double
)
position
.
absolute_altitude_m
;
positionArray
[
3
]
=
(
double
)
position
.
relative_altitude_m
;
positionArray
[
4
]
=
timestamp
;
return
positionArray
;
}
...
...
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