Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
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
Deploy
Releases
Model registry
Analyze
Model experiments
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
Skyward Boardcore
Commits
2209133e
Commit
2209133e
authored
2 months ago
by
Nicolò Caruso
Browse files
Options
Downloads
Patches
Plain Diff
[ARP] Gyro separated angles log struct and fix logging
parent
f8a35843
No related branches found
Branches containing commit
No related tags found
Loading
Pipeline
#11108
failed
2 months ago
Stage: lint
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/tests/sensors/logAnglesData.h
+24
-0
24 additions, 0 deletions
src/tests/sensors/logAnglesData.h
src/tests/sensors/test-vn300_gyro_to_angles.cpp
+7
-27
7 additions, 27 deletions
src/tests/sensors/test-vn300_gyro_to_angles.cpp
with
31 additions
and
27 deletions
src/tests/sensors/logAnglesData.h
0 → 100644
+
24
−
0
View file @
2209133e
struct
LogAngles
{
float
roll
,
pitch
,
yaw
;
LogAngles
()
:
roll
{
0
},
pitch
{
0
},
yaw
(
0
)
{}
LogAngles
(
float
Roll
,
float
Pitch
,
float
Yaw
)
:
roll
{
Roll
},
pitch
{
Pitch
},
yaw
(
Yaw
)
{
}
void
getAngles
(
float
x
,
float
y
,
float
z
)
{
this
->
roll
=
x
*
(
180
/
M_PI
);
this
->
pitch
=
y
*
(
180
/
M_PI
);
this
->
yaw
=
z
*
(
180
/
M_PI
);
}
static
std
::
string
header
()
{
return
"Roll,Pitch,Yaw,quaternionZ
\n
"
;
}
void
print
(
std
::
ostream
&
os
)
const
{
os
<<
roll
<<
","
<<
pitch
<<
","
<<
yaw
<<
"
\n
"
;
}
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/tests/sensors/test-vn300_gyro_to_angles.cpp
+
7
−
27
View file @
2209133e
...
...
@@ -21,6 +21,8 @@
*/
#include
<drivers/timer/TimestampTimer.h>
#include
<logAnglesData.h>
#include
<logger/Logger.h>
#include
<sensors/Vectornav/VN300/VN300.h>
#include
<Eigen/Dense>
...
...
@@ -36,31 +38,6 @@ using namespace Eigen;
using
namespace
miosix
;
using
namespace
Boardcore
;
struct
LogAngles
{
float
roll
,
pitch
,
yaw
;
LogAngles
()
:
roll
{
0
},
pitch
{
0
},
yaw
(
0
)
{}
LogAngles
(
float
Roll
,
float
Pitch
,
float
Yaw
)
:
roll
{
Roll
},
pitch
{
Pitch
},
yaw
(
Yaw
)
{
}
void
getAngles
(
float
x
,
float
y
,
float
z
)
{
this
->
roll
=
x
*
(
180
/
M_PI
);
this
->
pitch
=
y
*
(
180
/
M_PI
);
this
->
yaw
=
z
*
(
180
/
M_PI
);
}
static
std
::
string
header
()
{
return
"Roll,Pitch,Yaw,quaternionZ
\n
"
;
}
void
print
(
std
::
ostream
&
os
)
const
{
os
<<
roll
<<
","
<<
pitch
<<
","
<<
yaw
<<
"
\n
"
;
}
};
void
computeEulerAngles
(
const
Vector3d
&
gyro
,
double
dt
,
Vector3d
&
angles
)
{
Vector3d
body_rate
=
gyro
;
...
...
@@ -110,6 +87,8 @@ int main()
return
0
;
}
Logger
::
getInstance
().
start
();
uint64_t
t0
=
TimestampTimer
::
getTimestamp
();
Vector3d
angles
=
{
0
,
0
,
0
};
...
...
@@ -123,7 +102,8 @@ int main()
sensor
.
sample
();
sample
=
sensor
.
getLastSample
();
Logger
::
getInstance
().
log
(
sample
);
// getting last sample & logs
Logger
::
getInstance
().
log
<
VN300Data
>
(
sample
);
// getting last sample & logs
Vector3d
gyro
=
{
sample
.
angularSpeedX
,
sample
.
angularSpeedY
,
sample
.
angularSpeedZ
};
...
...
@@ -133,7 +113,7 @@ int main()
angles_log
.
getAngles
(
angles
(
0
),
angles
(
1
),
angles
(
2
));
printf
(
"Angles: %f, %f, %f
\n
"
,
angles_log
.
pitch
,
angles_log
.
roll
,
angles_log
.
yaw
);
Boardcore
::
Logger
::
getInstance
().
log
(
angles_log
);
Boardcore
::
Logger
::
getInstance
().
log
<
LogAngles
>
(
angles_log
);
t0
=
TimestampTimer
::
getTimestamp
();
}
...
...
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