主要内容

读取加速度、角速度磁场,时间,泛滥BNO055传感器的数据

自从R2019a

描述

例子

(sensorReadings,泛滥)=阅读(bno055)返回的加速度,磁场,角速度,并从BNO055溢出数据时间表格式。取决于样品的数量SamplesPerRead值在创建指定传感器对象。这些输出参数返回只有当输出格式设置时间表

例子

(accelReadings,gyroReadings,magReadings,时间戳,泛滥)=阅读(bno055)返回矩阵的加速度,陀螺仪、磁场、方向、时间戳、和泛滥AMG数据模式。取决于样品的数量SamplesPerRead值在创建指定传感器对象。这些输出参数返回只有当输出格式设置矩阵

例子

(accelReadings,gyroReadings,magReadings,orientationReadings,时间戳,泛滥)=阅读(bno055)返回矩阵的加速度,陀螺仪、磁场、时间戳、泛滥NDOF模式中的数据。取决于样品的数量SamplesPerRead值在创建指定传感器对象。这些输出参数返回只有当输出格式设置矩阵校准BNO055传感器使用前阅读,以确保准确的值读取传感器在NDOF操作模式。

例子

读取数据从传感器NDOF模式作为一个时间表

创建一个arduino对象。

一个= arduino (“COM4为”,“Uno”,“库”,“I2C”);

创建一个传感器对象附加属性。

imu = bno055 (,“OperatingMode”,“ndof”,“SamplesPerRead”5,“ReadMode”,“最新”)

使用步骤中提到校准传感器校准BNO055传感器。读五个传感器数据的样本datetime格式。

sensorReadings =阅读(imu)
sensorReadings = 5×4时间表时间加速AngularVelocity磁场取向________________________ _______________________ ______________________________________ ____________________________ ___________________________ 21 - 7 - 2020 16:24:25.538 0 0.35 9.82 0.0032725 - -0.0054542 -0.0021817 - 24.25 -19.375 - -2.75 -0.035997 - 0.0021817 2020年- 7月21日16:24:25.548 0 -0.05 0.32 9.84 -0.0021817 0.0010908 0.0010908 - 24.25 -19.375 - -2.75 -0.035997 - 0.0021817 2020年- 7月21日16:24:25.558 0 -0.03 0.32 9.75 -0.0010908 0.0010908 -0.0010908 - 24.25 -19.375 - -2.75 -0.035997 - 0.0021817 2020年- 7月21日16:24:25.568 0 0 0.34 9.82 0.0010908 -0.0021817 24.25 -19.375 -2.75 -0.035997 - 0.0021817 2020年- 7月21日16:24:25.578 0 0.36 9.77 0.006545 - -0.0010908 -0.0021817 - 23.063 -20.188 - -3.5625 -0.035997 - 0.0021817

从传感器读取数据在AMG模式作为一个时间表

创建一个arduino对象。

一个= arduino (“COM4为”,“Uno”,“库”,“I2C”);

创建一个传感器对象附加属性。

imu = bno055 (,“OperatingMode”,amg的,“SampleRate”,100,“SamplesPerRead”5)

读五个传感器数据的样本datetime格式。

sensorReadings =阅读(imu)
sensorReadings = 5×3时间表时间加速AngularVelocity磁场________________________ _______________________ ______________________________________ ____________________________ 21 - 7 - 2020 16:29:51.323 -0.02 0.32 9.87 0.0032725 -0.01309 0.0021817 24.25 -18.375 - 4 2020年- 7月21日16:29:51.333 -0.02 0.32 9.87 0.0032725 -0.0032725 0.0021817 24.25 -18.375 - 4 2020年- 7月21日16:29:51.343 0.02 0.35 9.82 -0.0032725 0.0076358 0.0032725 24.25 -18.375 - 4 2020年- 7月21日16:29:51.353 0.02 0.35 9.82 -0.0032725 0.0021817 0.0010908 23.125 -19.438 - 4 2020年- 7月21日16:29:51.363 0 -0.03 0.32 9.86 -0.0098175 0.0010908 23.125 -19.438 - 4

从传感器读取数据在NDOF模式矩阵

创建一个arduino对象。

一个= arduino (“COM4为”,“Uno”,“库”,“I2C”);

创建一个传感器对象附加属性。

imu = bno055 (,“SamplesPerRead”5“OutputFormat”,“矩阵”,“OperatingMode”、“ndof”)

使用步骤中提到校准传感器校准BNO055传感器。读五个传感器数据作为样本矩阵。

[accelReadings, gyroReadings magReadings orientationReadings,时间戳,泛滥]=阅读(imu)
accelReadings = -0.0400 0.3000 9.7500 -0.0500 0.3100 9.8400 -0.0200 0.3300 9.8100 0.3400 9.8800 -0.0400 0.3200 9.7700 gyroReadings = 0 0 0.0098 -0.0011 -0.0022 0.0055 0.0011 0.0022 -0.0022 -0.0011 -0.0022 0.0011 -0.0022 -0.0022 -0.0011 magReadings = 23.8750 -20.5625 -4.0000 23.8750 -20.5625 -4.0000 23.8750 -20.5625 -4.0000 23.0625 -20.8750 -4.7500 23.0625 -20.8750 -4.7500 orientationReadings = 0 0 0 0 -0.0338 0.0022 -0.0338 - 0.0022 -0.0338 - 0.0022 -0.0338 - 0.0022 -0.0338 - 0.0022 0时间戳= 5×2020 19:10:07.196 datetime数组31 - 7月31日——2020年7月- 2020 19:10:07.206 31 - 7月- 19:10:07.216 2020年- 7月31日19:10:07.226 2020年- 7月31日19:10:07.236泛滥= 10

从传感器读取数据在AMG模式矩阵

创建一个arduino对象。

一个= arduino (“COM4为”,“Uno”,“库”,“I2C”);

创建一个传感器对象附加属性。

imu = bno055 (,“SamplesPerRead”5“OutputFormat”,“矩阵”,“OperatingMode”、“amg”)

读五个传感器数据作为样本矩阵。

[accelReadings, gyroReadings magReadings orientationReadings,时间戳,泛滥]=阅读(imu)
accelReadings = -0.0400 0.3000 9.7500 -0.0500 0.3100 9.8400 -0.0200 0.3300 9.8100 0.3400 9.8800 -0.0400 0.3200 9.7700 gyroReadings = 0 0 0.0098 -0.0011 -0.0022 0.0055 0.0011 0.0022 -0.0022 -0.0011 -0.0022 0.0011 -0.0022 -0.0022 -0.0011 magReadings = 23.8750 -20.5625 -4.0000 23.8750 -20.5625 -4.0000 23.8750 -20.5625 -4.0000 23.0625 -20.8750 -4.7500 23.0625 -20.8750 -4.7500时间戳= 5×2020 19:10:07.196 datetime数组31 - 7月31日——2020年7月- 2020 19:10:07.206 31 - 7月- 19:10:07.216 2020年- 7月31日19:10:07.226 2020年- 7月31日19:10:07.236泛滥= 10

输入参数

全部折叠

BNO055传感器对象默认或指定属性。

输出参数

全部折叠

加速度、角速度和磁场数据从传感器读取输出格式设置的时候出现时间表。在ndof操作模式,传感器的定位值也回来了。的时间表返回以下字段:

  • 时间-时间戳datetime持续时间格式

  • 加速度——N-by-3数组单元的m / s2

  • AngularVelocity - N-by-3阵列在单位的rad / s

  • 磁场——在单位µT N-by-3数组(microtesla)

  • 取向——N-by-3数组以弧度为单位

数据类型:时间表

丢弃的数据样本之间的前阅读和当前阅读是泛滥。当泛滥是零ReadMode被设置为最古老的

数据类型:|

加速m / s2从传感器读取在x, y和z轴。N是样品在当前帧的数量。

数据类型:

角速度在rad / s从传感器读取x, y和z轴。N是样品在当前帧的数量。

数据类型:

磁场在µT (microtesla)从传感器读取x, y和z轴。N是样品在当前帧的数量。

数据类型:

定位在弧度从传感器读取x, y和z轴。N是样品在当前帧的数量。

数据类型:

时间时显示读取传感器数据。

  • datetime——显示的日期和时间数据读取。

  • 持续时间——显示时间在秒后的第一个电话函数或最后的执行释放函数。

更多关于

全部折叠

使用代码生成MATLAB功能块

  • 使用在MATLAB®功能块的金宝app®金宝app支持包Arduino®硬件生成的代码可以部署在Arduino硬件。

  • 不返回泛滥。

  • 总是返回矩阵。

版本历史

介绍了R2019a