Repository navigation
Home
We apologize for the inconvenience, this wiki is currently under construction
In the Android API, you may notice methods with different names, but which appear to perform the same function.
For example, Shimmer.setSamplingRateShimmer(rate) vs Shimmer.writeShimmerAndSensorsSamplingRate(rate)
The differences between these methods are as follows:
Set - Modifies the setting on the Shimmer object in code only. These settings still have to be written to the physical device using a command e.g. shimmer.writeConfigBytes()
Write - Modifies the setting on the Shimmer object in code AND writes the setting to the physical Shimmer device
Each ObjectCluster (message) received from the Shimmer devices contains a record of the time when the message or the sample was recorded. These records are known as timestamps.
Each message can contain multiple types of timestamps, and the differences between each are listed below. Note that these names are found in Configuration.Shimmer3.ObjectClusterSensorName
TIMESTAMP - This is the Shimmer internal device clock timestamp, and is taken a sample is recorded on the device. This is the most accurate timestamp for identifying the exact time when a sample was recorded.
SYSTEM_TIMESTAMP - This is the timestamp which is taken when a packet has been received on an Android device. This is less accurate than the Shimmer's internal clock, as there will be variable latency introduced between the sample being recorded on the Shimmer, and the packet being received on the Android device. This is due to the nature of the Bluetooth connection.
This latency cannot be avoided, but it can be mitigated in part by methods such as a linear fit, which can be found in Section 7.2 of the Multi Shimmer Sync for Android user manual.
SYSTEM_TIMESTAMP_PLOT - This is the current TIMESTAMP added to an offset.
This offset is calculated once, when the first packet is received, using the equation: OFFSET = SYSTEM_TIMESTAMP - TIMESTAMP. This ensures that the latency between a Shimmer recording a packet and transmitting it to the Android device is constant and equal to the latency of the first packet received.
TIMESTAMP_OFFSET - It is not recommended to use this, as this is used for SD parsing.
The recommended way of configuring a Shimmer devices is via the use of the Bluetooth Manager using clone devices The following are the recommended steps:
- Clone the Shimmer device – Note: a clone is a virtual copy of the Shimmer which you can freely configure without affecting the physical device.
- Configure the clone using “set” methods
- Generate a Shimmer config for the clone using: AssembleShimmerConfig.generateSingleShimmerConfig();
- Write the settings back from the clone to the physical Shimmer device using:
BluetoothManagerAndroid.configureShimmer(clone);Please see the code below for an example of this:
//Step 1)
Shimmer clone = (Shimmer) shimmer.deepClone();
//Step 2)
clone.setSensorEnabledState(Configuration.Shimmer3.SENSOR_ID.SHIMMER_ANALOG_ACCEL, true);
clone.setSensorEnabledState(Configuration.Shimmer3.SENSOR_ID.SHIMMER_LSM303_ACCEL, true);
clone.setSensorEnabledState(Configuration.Shimmer3.SENSOR_ID.SHIMMER_MPU9X50_GYRO, false);
clone.setSensorEnabledState(Configuration.Shimmer3.SENSOR_ID.SHIMMER_LSM303_MAG, false);
clone.setShimmerAndSensorsSamplingRate(512);
clone.setAccelRange(1);
//Step 3)
AssembleShimmerConfig.generateSingleShimmerConfig(clone, Configuration.COMMUNICATION_TYPE.BLUETOOTH);
//Step 4)
btManager.configureShimmer(clone);This example is only applicable for Shimmer3 devices onwards
It demonstrates the use of the following:
- New arrays data structure - Switching to using the new arrays data structure reduces the processing load on the Android device, which can benefit packet reception rate, especially on older devices. This example demonstrates how to enable the arrays data structure and retrieve data from it.
- Disabling PC Timestamps - This improves performance on Android devices, at the cost of slightly less accurate timestamps. When this is disabled, the timestamps will be taken on each full packet received, rather than on each byte received.
- CSV file writing
Note that the performance benefits from the above will only be apparent on lower-end or older Android devices.