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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolò Caruso
Skyward Boardcore
Commits
af2451a7
Commit
af2451a7
authored
Mar 13, 2020
by
Andrea Milluzzo
Browse files
Options
Downloads
Patches
Plain Diff
axel+gyro units adj
parent
2cd790c7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/shared/sensors/LSM9DS1/LSM9DS1_AxelGyro.h
+14
-21
14 additions, 21 deletions
src/shared/sensors/LSM9DS1/LSM9DS1_AxelGyro.h
src/tests/drivers/test-lsm9ds1.cpp
+6
-6
6 additions, 6 deletions
src/tests/drivers/test-lsm9ds1.cpp
with
20 additions
and
27 deletions
src/shared/sensors/LSM9DS1/LSM9DS1_AxelGyro.h
+
14
−
21
View file @
af2451a7
...
@@ -105,35 +105,28 @@ class LSM9DS1_XLG : public GyroSensor, public AccelSensor, public TemperatureSen
...
@@ -105,35 +105,28 @@ class LSM9DS1_XLG : public GyroSensor, public AccelSensor, public TemperatureSen
}
}
void
getWhoami
()
{
SPITransaction
spi
(
spislave
);
uint8_t
whoami
=
spi
.
read
(
regMapXLG
::
WHO_AM_I
);
TRACE
(
"whoami: 0x%02X
\n
"
,
whoami
);
}
bool
init
()
override
bool
init
()
override
{
{
//Set FSR
//Set FSR
switch
(
axelFSR
)
switch
(
axelFSR
)
//DA RIGUARDARE I COEFFICIENTI: SU DS C'E' SENSITIVITY IN mg/LSB
{
{
case
AxelFSR
::
FS_2
:
case
AxelFSR
::
FS_2
:
axelSensitivity
=
0.
061
f
;
axelSensitivity
=
0.
598
f
;
break
;
break
;
case
AxelFSR
::
FS_4
:
case
AxelFSR
::
FS_4
:
axelSensitivity
=
0
.1
22
f
;
axelSensitivity
=
1
.1
96
f
;
break
;
break
;
case
AxelFSR
::
FS_8
:
case
AxelFSR
::
FS_8
:
axelSensitivity
=
0.244
f
;
axelSensitivity
=
2.393
f
;
break
;
break
;
case
AxelFSR
::
FS_16
:
case
AxelFSR
::
FS_16
:
axelSensitivity
=
0.732
f
;
axelSensitivity
=
7.178
f
;
break
;
break
;
default:
default:
axelSensitivity
=
0.
061
f
;
axelSensitivity
=
0.
598
f
;
break
;
break
;
}
}
switch
(
gyroFSR
)
switch
(
gyroFSR
)
{
{
case
GyroFSR
::
FS_245
:
case
GyroFSR
::
FS_245
:
...
@@ -252,16 +245,16 @@ class LSM9DS1_XLG : public GyroSensor, public AccelSensor, public TemperatureSen
...
@@ -252,16 +245,16 @@ class LSM9DS1_XLG : public GyroSensor, public AccelSensor, public TemperatureSen
// TRACE("LSM9DS1 temp: %02X\n, temp");
// TRACE("LSM9DS1 temp: %02X\n, temp");
mLastAccel
=
mLastAccel
=
Vec3
(
x_xl
/
axelSensitivity
,
Vec3
(
x_xl
*
axelSensitivity
/
1000
,
y_xl
/
axelSensitivity
,
y_xl
*
axelSensitivity
/
1000
,
z_xl
/
axelSensitivity
);
z_xl
*
axelSensitivity
/
1000
);
mLastGyro
=
mLastGyro
=
Vec3
(
x_gy
/
gyroSensitivity
,
Vec3
(
x_gy
*
gyroSensitivity
/
1000
,
y_gy
/
gyroSensitivity
,
y_gy
*
gyroSensitivity
/
1000
,
z_gy
/
gyroSensitivity
);
z_gy
*
gyroSensitivity
/
1000
);
mLastTemp
=
tempZero
+
temp
/
tempSensistivity
;
//25°C + TEMP
/
S devo castare a float "temp"?
mLastTemp
=
tempZero
+
(
temp
/
tempSensistivity
)
;
//25°C + TEMP
*
S devo castare a float "temp"?
}
}
else
{
//if FIFO enabled: do not store temperature, it can be read using "temperatureUpdate()" function at low sampling frequency
else
{
//if FIFO enabled: do not store temperature, it can be read using "temperatureUpdate()" function at low sampling frequency
uint8_t
buf
[
384
];
uint8_t
buf
[
384
];
...
...
This diff is collapsed.
Click to expand it.
src/tests/drivers/test-lsm9ds1.cpp
+
6
−
6
View file @
af2451a7
...
@@ -76,20 +76,20 @@ int main(){
...
@@ -76,20 +76,20 @@ int main(){
while
(
!
lsm9ds1
.
init
()){}
while
(
!
lsm9ds1
.
init
()){}
Thread
::
sleep
(
500
);
Thread
::
sleep
(
500
);
long
long
first_tick
=
miosix
::
getTick
();
printf
(
"ax,ay,az,gx,gy,gz,t
\n
"
);
long
long
first_tick
=
getTick
();
for
(;;)
for
(;;)
{
{
long
long
tick
=
miosix
::
getTick
();
long
long
last_
tick
=
getTick
();
lsm9ds1
.
onSimpleUpdate
();
lsm9ds1
.
onSimpleUpdate
();
adata
=
*
(
lsm9ds1
.
accelDataPtr
());
adata
=
*
(
lsm9ds1
.
accelDataPtr
());
gdata
=
*
(
lsm9ds1
.
gyroDataPtr
());
gdata
=
*
(
lsm9ds1
.
gyroDataPtr
());
tdata
=
*
(
lsm9ds1
.
tempDataPtr
());
tdata
=
*
(
lsm9ds1
.
tempDataPtr
());
TRACE
(
"TIMESTAMP:%lld
\t
axel:
%.3f
,
%.3f
,
%.3f
\t
gyro:
%.3f
,
%.3f
,
%.3f
\t
temp:
%.
3
f
\n
"
,
printf
(
"%d;
%.3f
;
%.3f
;
%.3f
;
%.3f
;
%.3f
;
%.3f
;
%.
1
f
\n
"
,
tick
-
first_tick
,
(
last_
tick
-
first_tick
)
,
adata
.
getX
(),
adata
.
getY
(),
adata
.
getZ
(),
adata
.
getX
(),
adata
.
getY
(),
adata
.
getZ
(),
gdata
.
getX
(),
gdata
.
getY
(),
gdata
.
getZ
(),
gdata
.
getX
(),
gdata
.
getY
(),
gdata
.
getZ
(),
tdata
);
tdata
);
Thread
::
sleep
(
500
);
}
}
...
...
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