Skip to content
This repository was archived by the owner on Jul 20, 2025. It is now read-only.

Commit dd65930

Browse files
author
Stephen Schiffli
committed
Merge branch 'release-2.8.0'
2 parents e61a7a6 + 0f58516 commit dd65930

File tree

138 files changed

+6271
-3830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+6271
-3830
lines changed

Docs/gen_api_reference.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
appledoc -p "MetaWear iOS/macOS/tvOS API 2.7.3" --project-version "2.7.3" -c "MBIENTLAB INC" --company-id com.mbientlab --no-create-docset --no-repeat-first-par --ignore .m -o . ../MetaWear/Classes
1+
appledoc -p "MetaWear iOS/macOS/tvOS API 2.8.0" --project-version "2.8.0" -c "MBIENTLAB INC" --company-id com.mbientlab --no-create-docset --no-repeat-first-par --ignore .m -o . ../MetaWear/Classes
2+
open html/index.html
3+
4+
make html
5+
open build/html/index.html

Docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
# built documents.
5656
#
5757
# The short X.Y version.
58-
version = '2.7.3'
58+
version = '2.8.0'
5959
# The full version, including alpha/beta/rc tags.
60-
release = '2.7.3'
60+
release = '2.8.0'
6161

6262
# The language for content autogenerated by Sphinx. Refer to documentation
6363
# for a list of supported languages.

Docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ If you are not developing for the Apple ecosystem, we also offer an `Android API
5252
timer
5353
serial
5454
filters
55+
sensor_fusion

Docs/source/metawear_manager.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ This feature is handy because the ``discoveryTimeRSSI`` property on the discover
4949
if (device.discoveryTimeRSSI.integerValue < MIN_ALLOWED_RSSI) {
5050
continue;
5151
}
52-
[[MBLMetaWearManager sharedManager] stopScanForMetaWears];
52+
[[MBLMetaWearManager sharedManager] stopScan];
5353
// At this point we have a close MetaWear, do what you please with it!
5454
}
5555
}];

Docs/source/sensor_fusion.rst

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
.. highlight:: Objective-C
2+
3+
Sensor Fusion
4+
=============
5+
6+
The MetaMotion family of boards comes with a builtin Sensor Fusion algorithm. It's configured via properties on the `MBLSensorFusion <https://www.mbientlab.com/docs/metawear/ios/latest/Classes/MBLSensorFusion.html>`_ class.
7+
8+
As explained `here <http://www.chrobotics.com/library/attitude-estimation>`_. When estimating attitude and heading, the best results are obtained by combining data from multiple types of sensors to take advantage of their relative strengths. For example, rate gyros can be integrated to produce angle estimates that are reliable in the short-term, but that tend to drift in the long-term. Accelerometers, on the other hand, are sensitive to vibration and other non-gravity accelerations in the short-term, but can be trusted in the long-term to provide angle estimates that do no degrade as time progresses. Combining rate gyros and accelerometers can produce the best of both worlds - angle estimates that are resistant to vibration and immune to long-term angular drift.
9+
10+
Attitude and Heading
11+
--------------------
12+
13+
We provide attitude and heading information using both Euler Angles and Quaternions. Compared to quaternions, Euler Angles are simple and intuitive and they lend themselves well to simple analysis and control. On the other hand, Euler Angles are limited by a phenomenon called Gimbal Lock. In applications where the sensor will never operate near pitch angles of +/- 90 degrees, Euler Angles are a good choice. A quaternion is a four-element vector that can be used to encode any rotation in a 3D coordinate system. Technically, a quaternion is composed of one real element and three complex elements. It's best to start with Euler Angles unless you are already familiar with quaternions.
14+
15+
::
16+
17+
[self.device.sensorFusion.eulerAngle startNotificationsWithHandlerAsync:^(MBLEulerAngleData *obj, NSError *error) {
18+
NSLog(@"%@", obj);
19+
}];
20+
[self.device.sensorFusion.quaternion startNotificationsWithHandlerAsync:^(MBLQuaternionData *obj, NSError *error) {
21+
NSLog(@"%@", obj);
22+
}];
23+
24+
Gravity Reading
25+
---------------
26+
27+
This looks at the acceleration due to gravity and removes the acceleration due to motion. This vector always points to Earth.
28+
29+
::
30+
31+
[self.device.sensorFusion.gravity startNotificationsWithHandlerAsync:^(MBLAccelerometerData *obj, NSError *error) {
32+
NSLog(@"%@", obj);
33+
}];
34+
35+
Linear Acceleration
36+
-------------------
37+
38+
This looks at the acceleration due to motion and removes the acceleration due to gravity.
39+
40+
::
41+
42+
[self.device.sensorFusion.gravity startNotificationsWithHandlerAsync:^(MBLAccelerometerData *obj, NSError *error) {
43+
NSLog(@"%@", obj);
44+
}];
45+
46+
Corrected Sensor Readings
47+
-------------------------
48+
49+
Sensor fusion algorithms are able to use the strengths of various sensors to improve the weaknesses of others. This allows us to extract more accurate readings of sensor values.
50+
51+
::
52+
53+
[device.sensorFusion.acceleration startNotificationsWithHandlerAsync:^(MBLCorrectedAccelerometerData *obj, NSError *error) {
54+
NSLog(@"%@", obj);
55+
}];
56+
[device.sensorFusion.rotation startNotificationsWithHandlerAsync:^(MBLCorrectedGyroData *obj, NSError *error) {
57+
NSLog(@"%@", obj);
58+
}];
59+
[device.sensorFusion.magneticField startNotificationsWithHandlerAsync:^(MBLCorrectedMagnetometeData *obj, NSError *error) {
60+
NSLog(@"%@", obj);
61+
}];

MetaWear.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'MetaWear'
3-
s.version = '2.7.3'
3+
s.version = '2.8.0'
44
s.license = { :type => 'Commercial', :text => 'See https://www.mbientlab.com/terms/', :file => 'LICENSE' }
55
s.homepage = 'https://mbientlab.com'
66
s.summary = 'iOS/macOS/tvOS API and documentation for the MetaWear platform'

MetaWear/Classes/Categories/BFTask+MBLExtensions.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,32 @@ NS_ASSUME_NONNULL_BEGIN
5858

5959
typedef void (^MBLSuccessBlock)(ResultType result);
6060
typedef void (^MBLErrorBlock)(NSError *error);
61+
typedef __nullable id(^MBLExtensionsContinuationBlock)(BFTask<ResultType> *t);
6162

6263
/**
63-
Add a block to be called if the task finishes successfully, complete with the
64+
Add a block to be called if the task finishes successfully, complete with the
6465
tasks result. This callback will occur on the dispatchExecutor.
6566
*/
66-
- (instancetype)success:(MBLSuccessBlock)block;
67+
- (BFTask *)success:(MBLSuccessBlock)block;
6768

6869
/**
6970
Add a block to be called if the task finishes with an error.
7071
This callback will occur on the dispatchExecutor.
7172
*/
72-
- (instancetype)failure:(MBLErrorBlock)block;
73+
- (BFTask *)failure:(MBLErrorBlock)block;
7374

7475

7576
/**
7677
Enqueues the given block to be run once this task completes successfully.
7778
This callback will occur on the dispatchExecutor.
7879
*/
79-
- (instancetype)continueOnDispatchWithSuccessBlock:(BFContinuationBlock)block;
80+
- (BFTask *)continueOnDispatchWithSuccessBlock:(MBLExtensionsContinuationBlock)block NS_SWIFT_NAME(continueOnDispatchWithSuccess(block:));
8081

8182
/**
8283
Enqueues the given block to be run once this task completes.
8384
This callback will occur on the dispatchExecutor.
8485
*/
85-
- (instancetype)continueOnDispatchWithBlock:(BFContinuationBlock)block;
86+
- (BFTask *)continueOnDispatchWithBlock:(MBLExtensionsContinuationBlock)block NS_SWIFT_NAME(continueOnDispatch(block:));
8687

8788
@end
8889

MetaWear/Classes/Categories/BFTask+MBLExtensions.m

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*/
3535

3636
#import "BFTask+MBLExtensions.h"
37-
#import "BFTask+Private.h"
37+
#import "BFTask+MBLPrivate.h"
3838
#import "MBLMetaWearManager+Private.h"
3939

4040
@implementation BFExecutor (MBLExtensions)
@@ -56,7 +56,7 @@ + (BFExecutor *)dispatchExecutor
5656

5757
@implementation BFTask (MBLExtensions)
5858

59-
- (instancetype)success:(MBLSuccessBlock)block
59+
- (BFTask *)success:(MBLSuccessBlock)block
6060
{
6161
return [self continueOnDispatchWithSuccessBlock:^id _Nullable(BFTask * _Nonnull task) {
6262
// We need to send a non-null response but some tasks don't
@@ -66,7 +66,7 @@ - (instancetype)success:(MBLSuccessBlock)block
6666
}];
6767
}
6868

69-
- (instancetype)failure:(MBLErrorBlock)block
69+
- (BFTask *)failure:(MBLErrorBlock)block
7070
{
7171
return [self continueOnDispatchWithBlock:^id _Nullable(BFTask * _Nonnull task) {
7272
if (task.error) {
@@ -76,12 +76,12 @@ - (instancetype)failure:(MBLErrorBlock)block
7676
}];
7777
}
7878

79-
- (instancetype)continueOnDispatchWithSuccessBlock:(BFContinuationBlock)block
79+
- (BFTask *)continueOnDispatchWithSuccessBlock:(MBLExtensionsContinuationBlock)block
8080
{
8181
return [self continueWithExecutor:[BFExecutor dispatchExecutor] withSuccessBlock:block];
8282
}
8383

84-
- (instancetype)continueOnDispatchWithBlock:(BFContinuationBlock)block
84+
- (BFTask *)continueOnDispatchWithBlock:(MBLExtensionsContinuationBlock)block
8585
{
8686
return [self continueWithExecutor:[BFExecutor dispatchExecutor] withBlock:block];
8787
}
@@ -93,4 +93,3 @@ void MBLForceLoadCategory_BFTask_MBLExtensions()
9393
NSString *string = nil;
9494
[string description];
9595
}
96-

MetaWear/Classes/Core/MBLConstants.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ typedef NS_ENUM(uint8_t, MBLFirmwareVersion) {
6969
MBLFirmwareVersion1_2_2,
7070
MBLFirmwareVersion1_2_3,
7171
MBLFirmwareVersion1_2_4,
72-
MBLFirmwareVersion1_2_5
72+
MBLFirmwareVersion1_2_5,
73+
MBLFirmwareVersion1_3_0
7374
};
7475
NSString *MBLFirmwareVersionString(MBLFirmwareVersion version);
7576

@@ -103,6 +104,17 @@ typedef NS_ENUM(uint8_t, MBLLogLevel) {
103104
MBLLogLevelDebug = 4
104105
};
105106

107+
/**
108+
Rating of Sensor Fusion calibration status for data samples
109+
*/
110+
typedef NS_ENUM(uint8_t, MBLCalibrationAccuracy) {
111+
MBLCalibrationAccuracyUnreliable = 0,
112+
MBLCalibrationAccuracyLow = 1,
113+
MBLCalibrationAccuracyMedium = 2,
114+
MBLCalibrationAccuracyHigh = 3
115+
};
116+
NSString *MBLCalibrationAccuracyString(MBLCalibrationAccuracy accuracy);
117+
106118
#pragma mark - Block Typedefs
107119

108120
typedef void (^MBLVoidHandler)();
@@ -161,7 +173,7 @@ extern NSInteger const kMBLErrorConnectionTimeout;
161173
extern NSInteger const kMBLErrorWrongFirmwareModelNumber;
162174

163175
/*! @abstract 109: Couldn't perform DFU, no valid firmware releases found */
164-
extern NSInteger const kMBLErrorNoAvaliableFirmware;
176+
extern NSInteger const kMBLErrorNoAvailableFirmware;
165177

166178
/*! @abstract 110: MetaWear not connected, can't perform operation */
167179
extern NSInteger const kMBLErrorNotConnected;

MetaWear/Classes/Core/MBLConstants.m

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#import "MBLConstants.h"
3737
#import "MBLConstants+Private.h"
3838

39-
NSString *const kMBLAPIVersion = @"2.7.3";
39+
NSString *const kMBLAPIVersion = @"2.8.0";
4040

4141
NSString *MBLFirmwareVersionString(MBLFirmwareVersion version)
4242
{
@@ -67,6 +67,22 @@
6767
return @"1.2.4";
6868
case MBLFirmwareVersion1_2_5:
6969
return @"1.2.5";
70+
case MBLFirmwareVersion1_3_0:
71+
return @"1.3.0";
72+
}
73+
}
74+
75+
NSString *MBLCalibrationAccuracyString(MBLCalibrationAccuracy accuracy)
76+
{
77+
switch (accuracy) {
78+
case MBLCalibrationAccuracyUnreliable:
79+
return @"Unreliable";
80+
case MBLCalibrationAccuracyLow:
81+
return @"Low";
82+
case MBLCalibrationAccuracyMedium:
83+
return @"Medium";
84+
case MBLCalibrationAccuracyHigh:
85+
return @"High";
7086
}
7187
}
7288

@@ -83,7 +99,7 @@
8399
NSInteger const kMBLErrorUnexpectedDisconnect = 106;
84100
NSInteger const kMBLErrorConnectionTimeout = 107;
85101
NSInteger const kMBLErrorWrongFirmwareModelNumber = 108;
86-
NSInteger const kMBLErrorNoAvaliableFirmware = 109;
102+
NSInteger const kMBLErrorNoAvailableFirmware = 109;
87103
NSInteger const kMBLErrorNotConnected = 110;
88104
NSInteger const kMBLErrorInsufficientMemory = 111;
89105
NSInteger const kMBLErrorOperationInvalid = 112;

0 commit comments

Comments
 (0)