-
Notifications
You must be signed in to change notification settings - Fork 13
Data Structure
The ObjectCluster and Property Cluster class describes the data structure used within this library. The data structure is used to encapsulate data from the driver. The ObjectCluster is made up of a MultiMap (PropertyCluster) where each key represents a Property (e.g. Accelerometer X) and each value the FormatCluster of that property. The FormatCluster is an object which holds the format (e.g. Calibrated), units and data of the property.
This design was chosen to allow properties such as Linear Acceleration and orientation to be included easily in the future along with new formats such as filtered (low pass, high pass, etc). Through the use of MultiMaps, properties within the data structure can be found easily. More information on MultiMaps can be found here.
The arrays data structure was added as an alternative to the default Multimap data structure, for the purpose of improving packet reception rate performance on lower-end Android devices. The arrays data structure is disabled by default, and can be enabled/disabled using the following code:
shimmer.enableArraysDataStructure(true)
It is recommended that users only enable this if they are having issues with packet reception rate.
Example below shows how to retrieve data from a data structure.
Collection<FormatCluster> allFormats = objectCluster.getCollectionOfFormatClusters(Configuration.Shimmer3.ObjectClusterSensorName.TIMESTAMP);
FormatCluster timeStampCluster = ((FormatCluster)ObjectCluster.returnFormatCluster(allFormats,"CAL"));
double timeStampData = timeStampCluster.mData;
In order to retrieve the data from the sensors below,
Configuration.Shimmer3.SENSOR_ID.SHIMMER_ANALOG_ACCEL
Configuration.Shimmer3.SENSOR_ID.SHIMMER_LSM303_ACCEL
Configuration.Shimmer3.SENSOR_ID.SHIMMER_MPU9X50_GYRO
Configuration.Shimmer3.SENSOR_ID.SHIMMER_LSM303_MAG
please see, go to the file Configuration.java which defines the properties below
public static String ACCEL_LN_X = SensorKionixAccel.ObjectClusterSensorName.ACCEL_LN_X;
public static String ACCEL_LN_Y = SensorKionixAccel.ObjectClusterSensorName.ACCEL_LN_Y;
public static String ACCEL_LN_Z = SensorKionixAccel.ObjectClusterSensorName.ACCEL_LN_Z;
public static String ACCEL_WR_X = SensorLSM303.ObjectClusterSensorName.ACCEL_WR_X;
public static String ACCEL_WR_Y = SensorLSM303.ObjectClusterSensorName.ACCEL_WR_Y;
public static String ACCEL_WR_Z= SensorLSM303.ObjectClusterSensorName.ACCEL_WR_Z;
public static String MAG_X = SensorLSM303.ObjectClusterSensorName.MAG_X;
public static String MAG_Y = SensorLSM303.ObjectClusterSensorName.MAG_Y;
public static String MAG_Z = SensorLSM303.ObjectClusterSensorName.MAG_Z;
public static String GYRO_X = SensorMPU9X50.ObjectClusterSensorName.GYRO_X;
public static String GYRO_Y = SensorMPU9X50.ObjectClusterSensorName.GYRO_Y;
public static String GYRO_Z = SensorMPU9X50.ObjectClusterSensorName.GYRO_Z;