-
-
Save JpEncausse/23066976905cf15a5f7cfc5cabdc8a56 to your computer and use it in GitHub Desktop.
SensorFusion / Quaternion (MetaWear - NodeJS SDK - Linux)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
undefined -0.285400390625 -0.1104736328125 -0.9320068359375 | |
undefined -0.28656005859375 -0.11029052734375 -0.93048095703125 | |
undefined -0.28533935546875 -0.10992431640625 -0.92950439453125 | |
undefined -0.2862548828125 -0.10888671875 -0.931640625 | |
undefined -0.2864990234375 -0.10955810546875 -0.931884765625 | |
undefined -0.28692626953125 -0.11029052734375 -0.9345703125 | |
undefined -0.2852783203125 -0.10992431640625 -0.93267822265625 | |
undefined -0.28509521484375 -0.11029052734375 -0.93255615234375 | |
undefined -0.28607177734375 -0.11065673828125 -0.93048095703125 | |
undefined -0.28643798828125 -0.11114501953125 -0.931884765625 | |
undefined -0.2855224609375 -0.10955810546875 -0.93212890625 | |
undefined -0.28765869140625 -0.10888671875 -0.9310302734375 | |
undefined -0.285888671875 -0.11151123046875 -0.92987060546875 | |
undefined -0.2847900390625 -0.1087646484375 -0.929931640625 | |
undefined -0.28802490234375 -0.10943603515625 -0.9293212890625 | |
undefined -0.28662109375 -0.11126708984375 -0.9310302734375 | |
undefined -0.28533935546875 -0.10968017578125 -0.93121337890625 | |
undefined -0.284423828125 -0.10992431640625 -0.9327392578125 | |
undefined -0.2862548828125 -0.10968017578125 -0.93280029296875 | |
undefined -0.28533935546875 -0.10992431640625 -0.9312744140625 | |
undefined -0.28515625 -0.1102294921875 -0.93194580078125 | |
undefined -0.285400390625 -0.111083984375 -0.93194580078125 | |
undefined -0.28472900390625 -0.108642578125 -0.93048095703125 | |
undefined -0.28668212890625 -0.10992431640625 -0.92828369140625 | |
undefined -0.2857666015625 -0.11090087890625 -0.9317626953125 | |
undefined -0.28564453125 -0.110595703125 -0.929443359375 | |
undefined -0.28533935546875 -0.11016845703125 -0.9305419921875 | |
undefined -0.28619384765625 -0.11041259765625 -0.93145751953125 | |
undefined -0.28594970703125 -0.10882568359375 -0.9315185546875 | |
undefined -0.2857666015625 -0.10943603515625 -0.93157958984375 | |
undefined -0.28741455078125 -0.10986328125 -0.93255615234375 | |
undefined -0.2879638671875 -0.111083984375 -0.93035888671875 | |
undefined -0.28582763671875 -0.1107177734375 -0.92889404296875 | |
undefined -0.28448486328125 -0.109375 -0.930419921875 | |
undefined -0.284423828125 -0.1104736328125 -0.93255615234375 | |
undefined -0.2869873046875 -0.1094970703125 -0.93182373046875 | |
undefined -0.286376953125 -0.11041259765625 -0.930908203125 | |
undefined -0.28466796875 -0.10845947265625 -0.931640625 | |
undefined -0.28607177734375 -0.11077880859375 -0.930419921875 | |
undefined -0.2857666015625 -0.10882568359375 -0.93115234375 | |
undefined -0.28631591796875 -0.1094970703125 -0.93035888671875 | |
undefined -0.2877197265625 -0.11083984375 -0.93231201171875 | |
undefined -0.287353515625 -0.11151123046875 -0.9315185546875 | |
undefined -0.28515625 -0.11114501953125 -0.93243408203125 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ref = require('ref'); | |
var MetaWear = require('metawear'); | |
MetaWear.discoverByAddress('d3:dc:35:62:0d:2e', function(device) { | |
device.on('disconnect', function () { | |
console.log('we got disconnected! :( '); | |
}); | |
device.connectAndSetUp(function (error) { | |
console.log('Enable Quaterion') | |
var quaternion = MetaWear.mbl_mw_sensor_fusion_get_data_signal(device.board, MetaWear.MBL_MW_SENSOR_FUSION_DATA_QUATERION); | |
MetaWear.mbl_mw_datasignal_subscribe(quaternion, ref.NULL, MetaWear.FnVoid_VoidP_DataP.toPointer(function gotTimer(context, dataPtr) { | |
var data = dataPtr.deref(); | |
var pt = data.parseValue(); | |
console.log(pt.w, pt.x, pt.y, pt.z); | |
})); | |
MetaWear.mbl_mw_sensor_fusion_enable_data(device.board, MetaWear.MBL_MW_SENSOR_FUSION_DATA_QUATERNION); | |
console.log('Configure Mode') | |
MetaWear.mbl_mw_settings_set_connection_parameters(device.board, 7.5, 7.5, 0, 6000) | |
MetaWear.mbl_mw_sensor_fusion_set_mode(device.board, MetaWear.SensorFusionMode.NDOF) | |
MetaWear.mbl_mw_sensor_fusion_set_acc_range(device.board, MetaWear.MBL_MW_SENSOR_FUSION_ACC_RANGE_2G); | |
MetaWear.mbl_mw_sensor_fusion_set_gyro_range(device.board, MetaWear.MBL_MW_SENSOR_FUSION_GYRO_RANGE_250DPS); | |
MetaWear.mbl_mw_sensor_fusion_write_config(device.board) | |
console.log('Start streaming') | |
MetaWear.mbl_mw_sensor_fusion_start(device.board) | |
// Stop after 5 seconds | |
setTimeout(function () { | |
MetaWear.mbl_mw_sensor_fusion_stop(device.board) | |
MetaWear.mbl_mw_sensor_fusion_clear_enabled_mask(device.board) | |
MetaWear.mbl_mw_datasignal_unsubscribe(quaternion); | |
MetaWear.mbl_mw_debug_disconnect(device.board); | |
}, 4000); | |
}) | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment