Unable to Configure any sensor with Metahub except Accelerometer
Hello! I've just started using metahub on Raspberry Pi 4. I've tried to configure sensors with my Metamotion R. But only the accelerometer is working. None of the other sensors record any data.
My metabse-config.json looks like this:
{
"devices": [
{"mac": "F3:27:B3:2D:82:44", "name": "MetaMotion 1"}
],
"sensors": {
"Accelerometer": {"odr" : 100.0, "range": 4.0},
"Gyroscope": {"odr" : 100.0, "range": 1000.0},
"Magnetometer": {"odr" : 25.0},
"Temperature": {"period" : 1800.0 },
"Humidity": {"period" : 3600.0 }
}
}
The output appears like this:
Comments
Bluetooth limits the total data rate at 100Hz. You are trying to push something like 250Hz of data through...
Read the README and tutorials throughly first.
What could be the solution then? Using BLE dongle solves the problem?
I've also tried Accelerometer at 50Hz, and Gyroscope at 25Hz. That's a total 75Hz. Even that doesn't solve the issue
Then it means you did not format the config file properly. Make sure its in proper json format.
{
"devices": [
{"mac": "F3:27:B3:2D:82:44", "name": "MetaMotion 1"}
],
"sensors": {
"Accelerometer": {"odr" : 50.0, "range": 4.0},
"Gyroscope": {"odr" : 25.0, "range": 1000.0},
"Magnetometer": {"odr" : 25.0}
}
}
This is the configuration of my .json file.
Also when I try to only Configure the Gyroscope and Magnetometer, it gives the following output that shows error. I don't know why it's not working for Gyroscope and Magnetometer
**
info: Connecting to device mac=F3:27:B3:2D:82:44
info: Connecting to device mac=DA:A6:B6:FE:C2:71
info: Configuring devices
(node:1959) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'enums' of undefined
(node:1959) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
info: Window closed, data is still being written to the CSV file mac=f3:27:b3:2d:82:44**
Hey @arsalan26666,
I found out that the MetaHub MetaBase app hasn't been updated for the MMRL and MMS yet. I should have updates shortly.
I just updated the MetaHub App.
You can do a git pull on the MetaBase-Node folder.
https://github.com/mbientlab/MetaBase-Hub
Hello,
It seems I have a similar problem using python API
I can configure an accellerometer following the exemple https://github.com/mbientlab/MetaWear-SDK-Python/blob/master/examples/stream_acc_gyro.py
with
libmetawear.mbl_mw_acc_set_odr(s.device.board, 100.0)
libmetawear.mbl_mw_acc_set_range(s.device.board, 16.0)
libmetawear.mbl_mw_acc_write_acceleration_config(s.device.board)
but when I try ton configure a gyro with
libmetawear.mbl_mw_gyro_bmi160_set_range(d.board, 2000.0);
#libmetawear.mbl_mw_gyro_bmi160_set_odr(d.board, fs);
libmetawear.mbl_mw_gyro_bmi160_write_config(d.board);
I get an error message libmetawear.mbl_mw_gyro_bmi160_set_range(d.board, 2000.0);
ArgumentError: argument 2: : wrong type
Does your sensor have a bmi160 or a bmi270? You are using the bmi160 calls.
I start measurement with
libmetawear.mbl_mw_gyro_bmi160_enable_rotation_sampling(d.board)
libmetawear.mbl_mw_gyro_bmi160_start(d.board)
and get data
If I try
libmetawear.mbl_mw_gyro_bmi270_enable_rotation_sampling(d.board)
libmetawear.mbl_mw_gyro_bmi270_start(d.board)
program fails with message "core dump"
here are the id of the devices
d1 = MetaWear('FC:26:7F:82:0A:B3')
d2 = MetaWear('E6:E9:F3:34:4C:CD')
Its probably an issue with your actual coding syntax.
I don't think so or the problem is in the example
I made a test with the exact copy of https://github.com/mbientlab/MetaWear-SDK-Python/blob/master/examples/stream_acc_gyro.py
for s in states:
print("Configuring device")
libmetawear.mbl_mw_settings_set_connection_parameters(s.device.board, 7.5, 7.5, 0, 6000)
sleep(1.5)
And get the same error message
libmetawear.mbl_mw_gyro_bmi160_set_range(s.device.board, 2000.0);
ArgumentError: argument 2: : wrong type
please notice that there is no problem with accelerometer but only with gyroscope. I also tried to comment the range
#libmetawear.mbl_mw_gyro_bmi160_set_range(s.device.board, 2000.0);
libmetawear.mbl_mw_gyro_bmi160_set_odr(s.device.board, 25.0);
libmetawear.mbl_mw_gyro_bmi160_write_config(s.device.board);
and problem is the same with frequency
libmetawear.mbl_mw_gyro_bmi160_set_odr(s.device.board, 25.0);
ArgumentError: argument 2: : wrong type
So if there is an issue, it's not with MY coding syntax but with coding syntax provided in the example. Was it tested with the configuration line active ?
Please factor your code correctly in this thread and take a screenshot of the issue when you run the script. I cannot follow anything in your comment.
I run the exact copy of https://github.com/mbientlab/MetaWear-SDK-Python/blob/master/examples/stream_acc_gyro.py
command line : python stream_acc_gyro.py 'FC:26:7F:82:0A:B3'
Everything runs as expected top part of the screenshoot
I uncomment lines 40, 41 and 42
libmetawear.mbl_mw_gyro_bmi160_set_range(s.device.board, 2000.0);
libmetawear.mbl_mw_gyro_bmi160_set_odr(s.device.board, 25.0);
libmetawear.mbl_mw_gyro_bmi160_write_config(s.device.board);
with the same command line : python stream_acc_gyro.py 'FC:26:7F:82:0A:B3' (you can see it on the screenshot)
I get the error message you can read in the screen shot (the same I reported before)
If you don't understand my comment pleas tell me which line
Well it does tell you the issue. The type is not int for
It's (according to the CPP docs)
So just make the 2000.0 not an int but a MblMwGyroBoschRange type.
So for Python, you look at the bindings to check the type:
Ok cool so now,
or
Please understand this is a development board so you need to be confident with your software development skills and debug yourself a little bit (the error tells your everything you need to know: WRONG TYPE ON ARG 2.
Many thanks for the solution and for the advice. I will work to improve my skill.
And I hope at the same time quality of examples will be improved too. Or let me dream beeing tested before they are uploaded.
Just one remark 2000.0 is not an int but a float
@ericf,
Awesome, you are already on your way to becoming a debug pro!
Hey Laura! still no luck unfortunately
Ok, Why don't you use the latest hub image and try again? Maybe you have some issues in your setup.
What is the version of latest hub image please?
https://www.dropbox.com/s/g2jeb7n0qyeodrr/MetaHub.img.zip?dl=0