Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
On-Board Software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
On-Board Software
Commits
18f253c4
Commit
18f253c4
authored
9 months ago
by
Emilio Corigliano
Browse files
Options
Downloads
Patches
Plain Diff
[AutomatedAntennas] Implemented logdecoder to deserialize logs
parent
49aa0f98
Branches
Branches containing commit
Tags
v3.0.0-preview1
Tags containing commit
1 merge request
!48
[GS, ARP] New entrypoint for lyra_gs and ARP related things
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/scripts/logdecoder/AutomatedAntennas/Makefile
+16
-0
16 additions, 0 deletions
src/scripts/logdecoder/AutomatedAntennas/Makefile
src/scripts/logdecoder/AutomatedAntennas/logdecoder.cpp
+122
-0
122 additions, 0 deletions
src/scripts/logdecoder/AutomatedAntennas/logdecoder.cpp
with
138 additions
and
0 deletions
src/scripts/logdecoder/AutomatedAntennas/Makefile
0 → 100644
+
16
−
0
View file @
18f253c4
BOARDCORE
:=
../../../../skyward-boardcore/
OBSW
:=
../../../../src/boards/
all
:
g++
-std
=
c++17
-O2
-o
logdecoder logdecoder.cpp
\
-DCOMPILE_FOR_X86
\
-DCOMPILE_FOR_HOST
\
$(
BOARDCORE
)
libs/tscpp/tscpp/stream.cpp
\
-I
$(
BOARDCORE
)
libs/miosix-host
\
-I
$(
BOARDCORE
)
libs/mavlink-skyward-lib
\
-I
$(
BOARDCORE
)
libs/eigen
\
-I
$(
BOARDCORE
)
libs/tscpp
\
-I
$(
BOARDCORE
)
src/shared
\
-I
$(
OBSW
)
clean
:
rm
logdecoder
This diff is collapsed.
Click to expand it.
src/scripts/logdecoder/AutomatedAntennas/logdecoder.cpp
0 → 100644
+
122
−
0
View file @
18f253c4
/* Copyright (c) 2018-2022 Skyward Experimental Rocketry
* Author: Terrane Federico
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include
<AutomatedAntennas/ActuatorsData.h>
#include
<logger/Deserializer.h>
#include
<logger/LogTypes.h>
#include
<tscpp/stream.h>
#include
<fstream>
#include
<iostream>
#include
<stdexcept>
#include
<string>
/**
* @brief Binary log files decoder.
*
* This program is to compile for you computer and decodes binary log files
* through the tscpp library.
*
* In LogTypes.h there should be included all the classes you want to
* deserialize.
*/
using
namespace
tscpp
;
using
namespace
Boardcore
;
using
namespace
Antennas
;
void
registerTypes
(
Deserializer
&
ds
)
{
// Register all Boardcore types
LogTypes
::
registerTypes
(
ds
);
// Custom types
ds
.
registerType
<
StepperXData
>
();
ds
.
registerType
<
StepperYData
>
();
}
void
showUsage
(
const
string
&
cmdName
)
{
std
::
cerr
<<
"Usage: "
<<
cmdName
<<
" {-a | <log_file_name> | -h}"
<<
"Options:
\n
"
<<
"
\t
-h,--help
\t\t
Show help message
\n
"
<<
"
\t
-a,--all Deserialize all logs in the current directory
\n
"
<<
std
::
endl
;
}
bool
deserialize
(
string
logName
)
{
std
::
cout
<<
"Deserializing "
<<
logName
<<
"...
\n
"
;
Deserializer
d
(
logName
);
LogTypes
::
registerTypes
(
d
);
registerTypes
(
d
);
return
d
.
deserialize
();
}
bool
deserializeAll
()
{
for
(
int
i
=
0
;
i
<
100
;
i
++
)
{
char
nextName
[
11
];
sprintf
(
nextName
,
"log%02d.dat"
,
i
);
struct
stat
st
;
if
(
stat
(
nextName
,
&
st
)
!=
0
)
continue
;
// File not found
// File found
if
(
!
deserialize
(
string
(
nextName
)))
return
false
;
}
return
true
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<
2
)
{
showUsage
(
string
(
argv
[
0
]));
return
1
;
// Error
}
bool
success
=
false
;
string
arg1
=
string
(
argv
[
1
]);
// Help message
if
(
arg1
==
"-h"
||
arg1
==
"--help"
)
{
showUsage
(
string
(
argv
[
0
]));
return
0
;
}
// File deserialization
if
(
arg1
==
"-a"
||
arg1
==
"--all"
)
success
=
deserializeAll
();
else
success
=
deserialize
(
arg1
);
// End
if
(
success
)
std
::
cout
<<
"Deserialization completed successfully
\n
"
;
else
std
::
cout
<<
"Deserialization ended with errors
\n
"
;
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment