(30 gadget day 1) MYO get started

Time:2020-10-29

MYO

Myo is a new HCI device similar to leap motion. It is worn on the forearm, so that it can sense the electrical current of human muscles, and then recognize various gestures, such as waving to the left and right.

(30 gadget day 1) MYO get started

Several uses of the official myo are

  • Show it. You can change pages with a wave of your hand, or make prezi’s controls what they should be.
  • Control the phone. For example, when you run, you can switch songs by waving, play 1024 and so on.
  • Smart home. Just snap your finger and turn on the TV.
  • Control those who run. Sphero and parrot drone are now supported.

Another example that I find cool isArmin Van BuurenUse myo in a show to help enhance live performance. It has the feeling of real-time large-scale interactive performance in the future. You can search the specific performance videos by yourself.

(30 gadget day 1) MYO get started

I bought two myo wristbands. Let’s think about what we can do with them in the next three days

(30 gadget day 1) MYO get started

Structure of myo

(30 gadget day 1) MYO get started

The middle part of the whole myo near the skin is covered with various metal contacts, so when you wear it, you don’t care about the angle. Standard micro USB is used for charging.

(30 gadget day 1) MYO get started

Developer Perspective

Similar to leap motion, myo provides two types of input data: spatial data, gestural data, and the only feedback interface, vibration command.

Spatial data includes two dimensions: orientation and acceleration vector.
Gesture data includes several specific gestures, such as clenching.

iOS sample

Of course, myo provides SDKs for all platforms (except Windows Phone, of course). The most convenient way to develop is Mac. Windows needs to install a bunch of drivers. If you are only developing applications, it’s good to deal with the Android / IOS SDK. If you need underlying data, myo also provides C lib API. In addition, there is another one written in LuaMyo Scripts

(30 gadget day 1) MYO get started

Similar to the use of various sensors, myo’s data is provided in the form of callback delivery events. Myo provides three types of events, such as space events, gesture events, and some auxiliary events (such as connecting, disconnecting devices, etc.).

The best way to develop a myo application is to run the sample program first. The IOS SDK includes a doc and a sample program called hellomyo. Open sample, run and play. (the development speed of the myo SDK is very fast, so if you find that the sample program tells you that the version is too low, you need to connect the USB and Bluetooth transmitter for an upgrade).

Look at the code.

- (void)viewDidLoad {
    [super viewDidLoad];

    // Data notifications are received through NSNotificationCenter.
    // Posted whenever a TLMMyo connects
    [[NSNotificationCenter defaultCenter] addObserver:self
                                          selector:@selector(didConnectDevice:)
                                          name:TLMHubDidConnectDeviceNotification
                                          object:nil];
    // Posted whenever a TLMMyo disconnects.
    [[NSNotificationCenter defaultCenter] addObserver:self
                                          selector:@selector(didDisconnectDevice:)
                                          name:TLMHubDidDisconnectDeviceNotification
                                          object:nil];
...
    // Posted when a new pose is available from a TLMMyo.
    [[NSNotificationCenter defaultCenter] addObserver:self
                                          selector:@selector(didReceivePoseChange:)
                                          name:TLMMyoDidReceivePoseChangedNotification
                                          object:nil];

}

The first step is to register various events, including disconnection. Here is aSync GestureThis is a strange action. Myo should be used to make a basic base line for arm muscle current.

Perhaps the most useful is tlmmodidreceiveposechangednotification. Once a new pose is detected, the function receives a callback. Take a look at the content of this callback.

- (void)didReceivePoseChange:(NSNotification *)notification {
    // Retrieve the pose from the NSNotification's userInfo with the kTLMKeyPose key.
    TLMPose *pose = notification.userInfo[kTLMKeyPose];
    self.currentPose = pose;

    // Handle the cases of the TLMPoseType enumeration, and change the color of helloLabel based on the pose we receive.
    switch (pose.type) {
        case TLMPoseTypeUnknown:
        case TLMPoseTypeRest:
        case TLMPoseTypeDoubleTap:
            // Changes helloLabel's font to Helvetica Neue when the user is in a rest or unknown pose.
            self.helloLabel.text = @"Hello Myo";
            self.helloLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:50];
            self.helloLabel.textColor = [UIColor blackColor];
            break;
        case TLMPoseTypeFist:
            // Changes helloLabel's font to Noteworthy when the user is in a fist pose.
            self.helloLabel.text = @"Fist";
            self.helloLabel.font = [UIFont fontWithName:@"Noteworthy" size:50];
            self.helloLabel.textColor = [UIColor greenColor];
            break;
        case TLMPoseTypeWaveIn:
            // Changes helloLabel's font to Courier New when the user is in a wave in pose.
            self.helloLabel.text = @"Wave In";
            self.helloLabel.font = [UIFont fontWithName:@"Courier New" size:50];
            self.helloLabel.textColor = [UIColor greenColor];
            break;
        case TLMPoseTypeWaveOut:
            // Changes helloLabel's font to Snell Roundhand when the user is in a wave out pose.
            self.helloLabel.text = @"Wave Out";
            self.helloLabel.font = [UIFont fontWithName:@"Snell Roundhand" size:50];
            self.helloLabel.textColor = [UIColor greenColor];
            break;
        case TLMPoseTypeFingersSpread:
            // Changes helloLabel's font to Chalkduster when the user is in a fingers spread pose.
            self.helloLabel.text = @"Fingers Spread";
            self.helloLabel.font = [UIFont fontWithName:@"Chalkduster" size:50];
            self.helloLabel.textColor = [UIColor greenColor];
            break;
    }

    // Unlock the Myo whenever we receive a pose
    if (pose.type == TLMPoseTypeUnknown || pose.type == TLMPoseTypeRest) {
        // Causes the Myo to lock after a short period.
        [pose.myo unlockWithType:TLMUnlockTypeTimed];
    } else {
        // Keeps the Myo unlocked until specified.
        // This is required to keep Myo unlocked while holding a pose, but if a pose is not being held, use
        // TLMUnlockTypeTimed to restart the timer.
        [pose.myo unlockWithType:TLMUnlockTypeHold];
        // Indicates that a user action has been performed.
        [pose.myo indicateUserAction];
    }
}

These are the built-in gestures:

Tlmposetypedoubletap
Tlmposetypefist
Tlmpose type wave in
Tlmposetypewaveout (wave out)
Tlmposetypefingers spread

This is the basic code. Tomorrow we’ll try to connect this with other features.