Community news, upcoming events and general discussions
Threads: 34 Posts: 86
Get technical support from the community
Threads: 1332 Posts: 7252
Threads: 18 Posts: 64
Tell us how to make XDK better!
Threads: 35 Posts: 117
Share and discuss community member projects
Threads: 76 Posts: 336
i'm trying to set/modify the sampling rate of the XDK. Based on the example "StreamingSensorDataOverUsb" and the "enbale all Sensor in one" => https://developer.bosch.com/web/xdk/enable-all-sensors-in-one
But there seems to be no sample rate variable that could be modified.
My goal is to be able to have for example one sensor active and this sensor beeing able to get data on High speed, or more sensors on a lower sampling speed.
When I try to look into the DataLogger Demo, that gets its configuration from the logger.ini from the SD Card there are sampling rates provided. But this project is kind of huge to modify, and its very different from the two examples above with a different way of setting up the sensors which is very confusing.
I'd appreciate any help. Thank you in advance
Based on the example "StreamingSensorDataOverUsb" I find it easiest if you create several tasks and set the speed of the data over different delays. For example, you can create a task for the accelerometer sensor and set
vTaskDelay (pdMS_TO_TICKS (200));
vTaskDelay (pdMS_TO_TICKS (200));
so every 200 ms data is output, and so on.
thank you for the response.
That was an solution i was thinking about too. But it didn't feel quite comfortable having such an "dirty" workaround in my eyes.
Also if i come to think about it is this delay just when you get the data from the sensor, or when the sensor actually samples a set of data?
In the DataLogger example there are 2 kind of variables for that with "bandwith" and "sampling rate" if im not mistaken.
Another problem that you run into is, that you only are able tohave the same sampling rate for all active sensors and you are not able to individually set their sampling rate. If you try to do this with individual delays. And to make this happen you would need some kind of multithreading, which kind of feels overboard. Because worst case szenario would have 7-8 seperate threads (if the enviromental sensor is able to have different threads which im quite not sure right now) but that looks like it would be way too complicated and there has to be a way easier solution?
Is there a likewise easy option to somehow merge those 2 examples to have a clean, lighwight and easy code?
In order to work a little cleaner I would use freeRTOS timer. The USB sample has been created for demonstration purposes and is not suitable for high-speed sampling. If you do not want to call the data periodically, use datalogger application:
user can work with datalogger trail version for free and purchase full version for 59 euro
thank you for your response. The idea with the timer sounds very interesting and might solve my problem. I thought that the USB sample might be used as some kind of template to dig into the world of XDK and try and error.
I have referred to the DataLogger application above, but sadly it's a very big poject that is very hard to understand and to keep a clear view. Therefor it's quite hard to modify or edit to your costum needs.
In the end I will try the approach using the freeRTOS timer, which sounds promising.