Documentation

Toggle Menu

Myo (By Thalmic Labs)

This tile will allow you to easily interface with your Myo Armband made by Thalmic Labs.
Note that this tile has only been tested with one armband, so the Usage Demos below are only written for one armband. Two armbands should be able to connect to the same tile as long as they both have different device names, and should be distiguished between by using their device names as identifiers in the Python code.

Settings

Tag

This is a unique String ID assigned to this tile and is used (by you) to identify what tile sent what data by your script.
Note that this is case sensitive, and cannot contain any white space.

Filter

Events

Here you can select what events are sent from your myo to the Force Server. Options are as follows:

  • Connected

  • Disconnected

  • Sync

  • Unsync

  • Lock

  • Unlock

  • EMG

  • Accelerometer

  • Gyroscope

  • Orientation

  • Pose

Poses

Here you can select which poses are sent to the Force Server when they are recognised. Options are as follows:

  • Unknown

  • Rest

  • Double Tap

  • Fingers Spread

  • Fist

  • Wave In

  • Wave Out

Sync Data

Here you can select what sync data is sent when the armband is synced. Options are as follows:

  • Arm

  • Direction

Myo Locking

Here you can set the locking policy for the Myo armband.
Note that this only locks poses from being sent. Motion data such as accelerometer and gyroscope data will always be sent.

  • None will result in all recognised gestures to be sent. This is best for scenarios that require constant data like games and robots.

  • Standard will require a double tap gesture to be done for the armband to be temporarily unlocked and for gestures to be sent. This is the default in many applications.

Accelerometer

Here you can select when and what accelerometer data is sent to the Force Server.

Accelerometer Axis

Here you can pick what data is sent to the Force Server from the Myo Armband's accelerometer. Options are as follows:

  • X

  • Y

  • Z

  • Magnitude

Send Accelerometer Event

This is when the accelerometer data is sent to the Force Server, the three options are:

  • Always

  • During Pose (While a pose is being held)

  • Between Poses (After begin pose is activated, until an end pause is activated)

Note you may only select one.

Send During Pose

This option will come up when During Pose is selected. You have the option of picking one or more of the poses below:

  • Fingers Spread

  • Fist

  • Wave In

  • Wave Out

Send After Pose & Stop Sending After Pose

These two options will pop up if Between Poses is selected. The available activation and deactivation poses are as follows:

  • Double Tap

  • Fingers Spread

  • Fist

  • Wave In

  • Wave Out

Note that the same pose may be selected for activation and deactivation, but it is recommended that different poses are used as there may be issues if the Myo recognises the same pose twice at the same time.

Gyroscope

Here you can select when and what gyroscope data is sent to the Force Server.

Gyroscope Axis

Here you can pick what data is sent to the Force Server from the Myo Armband's gyroscope. Options are as follows:

  • X

  • Y

  • Z

  • Magnitude

Send Gyroscope Event

This is when the gyroscope data is sent to the Force Server, the three options are:

  • Always

  • During Pose (While a pose is being held)

  • Between Poses (After begin pose is activated, until an end pause is activated)

Note you may only select one.

Send During Pose

This option will come up when During Pose is selected. You have the option of picking one or more of the poses below:

  • Fingers Spread

  • Fist

  • Wave In

  • Wave Out

Send After Pose & Stop Sending After Pose

These two options will pop up if Between Poses is selected. The available activation and deactivation poses are as follows:

  • Double Tap

  • Fingers Spread

  • Fist

  • Wave In

  • Wave Out

Note that the same pose may be selected for activation and deactivation, but it is recommended that different poses are used as there may be issues if the Myo recognises the same pose twice at the same time.

Orientation

Here you can set the when and what data is sent to the Force Server from the Myo armband. You can also set the unit of measurement.

Orientation Angle Unit

The Force app automatically converts the angle data to either radians or degrees. Choose whichever one suites your project.

Here you can pick what data is sent to the Force Server from the Myo Armband. Options are as follows:

  • Roll

  • Pitch

  • Yaw

Send Orientation Event

This is when the orientation data is sent to the Force Server, the three options are:

  • Always

  • During Pose (While a pose is being held)

  • Between Poses (After begin pose is activated, until an end pause is activated)

Note you may only select one.

Send During Pose

This option will come up when During Pose is selected. You have the option of picking one or more of the poses below:

  • Fingers Spread

  • Fist

  • Wave In

  • Wave Out

Send After Pose & Stop Sending After Pose

These two options will pop up if Between Poses is selected. The available activation and deactivation poses are as follows:

  • Double Tap

  • Fingers Spread

  • Fist

  • Wave In

  • Wave Out

Note that the same pose may be selected for activation and deactivation, but it is recommended that different poses are used as there may be issues if the Myo recognises the same pose twice at the same time.

EMG

Send EMG Event

This is when the EMG data is sent to the Force Server, the three options are:

  • Always

  • During Pose (While a pose is being held)

  • Between Poses (After begin pose is activated, until an end pause is activated)

Note you may only select one.

Send During Pose

This option will come up when During Pose is selected. You have the option of picking one or more of the poses below:

  • Fingers Spread

  • Fist

  • Wave In

  • Wave Out

Send After Pose & Stop Sending After Pose

These two options will pop up if Between Poses is selected. The available activation and deactivation poses are as follows:

  • Double Tap

  • Fingers Spread

  • Fist

  • Wave In

  • Wave Out

Note that the same pose may be selected for activation and deactivation, but it is recommended that different poses are used as there may be issues if the Myo recognises the same pose twice at the same time.

Input

You can easily interact with the Myo by sending messages to this tile as follows.

  • String"\\LOCK\\" → Lock the attached Myo.

  • String"\\UNLOCK_TIMED\\" → Unlock the attached Myo for a short period of time.

  • String"\\UNLOCK_HOLD\\" → Unlock the attached Myo until a Lock command is received.

  • String"\\VIBRATE_SHORT\\" → Short vibrate the attached Myo.

  • String"\\VIBRATE_MID\\" → Medium vibrate the attached Myo.

  • String"\\VIBRATE_LONG\\" → Long vibrate the attached Myo.

Usage Demo

This is a simple demo where if a robot detects an obstacle ahead, it will notify the user via vibrations from the Myo armband. If the robot is too close to an obstacle, it will lock the Myo so that it will not send data until the user unlocks it.

                            def obstacleDetected(self, distance):
                                if distance < 25:
                                    # Stop bot from receiving input until the user deliberately unlocks
                                    self.stopBot()
                                    self.force.sendMessage("Jordan's iPhone", "Myo", "\\LOCK\\")
                                elif distance < 100:
                                    self.force.sendMessage("Jordan's iPhone", "Myo", "\\VIBRATE_LONG\\")
                                elif distance < 300:
                                    self.force.sendMessage("Jordan's iPhone", "Myo", "\\VIBRATE_MID\\")
                                elif distance > 300:
                                    self.force.sendMessage("Jordan's iPhone", "Myo", "\\VIBRATE_SHORT\\")
                            

Output

The following is what data is sent from this tile to the server/your script. It is in the format:
Action → Data TypeValue

Myo Connected → Dictionary → {

  • "Myo Name" : String

  • "Event" : String → "Connected"

}

When the Myo connects to the iOS device, set the status light on the robot to green.

                                    def forceServerDidReceiveData(self, deviceName, senderTag, data):
                                        if senderTag == 'Myo':
                                            if data["Event"] == 'Connected':
                                                self.setStatusLEDToGreen()
                                    
Show Python

Myo Disconnected → Dictionary → {

  • "Myo Name" : String

  • "Event" : String → "Disconnected"

}

When the Myo disconnects to the iOS device, set the status light on the robot to red.

                                    def forceServerDidReceiveData(self, deviceName, senderTag, data):
                                        if senderTag == 'Myo':
                                                if data["Event"] == 'Disconnected':
                                                    self.setStatusLEDToRed()
                                    
Show Python

Myo Unsynced → Dictionary → {

  • "Myo Name" : String

  • "Event" : String → "Unsynced"

}

Set a boolean variable to false when the Myo gets unsynced so that false data is not sent. This is only precautionary as the armband usually handles its sync state well.

                                    def forceServerDidReceiveData(self, deviceName, senderTag, data):
                                        if senderTag == 'Myo':
                                                if data["Event"] == 'Unsynced':
                                                    self.myoCanControl = False
                                    
Show Python

Myo Locked → Dictionary → {

  • "Myo Name" : String

  • "Event" : String → "Locked"

}

When the Myo is locked, set a label on the device to reflect the state of the armband.

                                    def forceServerDidReceiveData(self, deviceName, senderTag, data):
                                        if senderTag == 'Myo':
                                                if data["Event"] == 'Locked':
                                                    self.force.sendMessage("Jordan's iPhone", "myoStatusLabel", 'Myo Locked')
                                    
Show Python

Myo Unlocked → Dictionary → {

  • "Myo Name" : String

  • "Event" : String → "Unlocked"

}

When the Myo is unlocked, set a label on the device to reflect the state of the armband.

                                    def forceServerDidReceiveData(self, deviceName, senderTag, data):
                                        if senderTag == 'Myo':
                                                if data["Event"] == 'Unlocked':
                                                    self.force.sendMessage("Jordan's iPhone", "myoStatusLabel", 'Myo Unlocked')
                                    
Show Python

Myo Accelerometer Event → Dictionary → {

  • "Myo Name" : String

  • "Event" : String → "AccelerometerEvent"

  • "Data" : Dictionary → {

    • "X" : Float

    • "Y" : Float

    • "Z" : Float

    • "Magnitude" : Float

    }

}

When accelerometer data is received, extract it and pass it to a function which will make use of the input accordingly.

                                    def forceServerDidReceiveData(self, deviceName, senderTag, data):
                                        if senderTag == 'Myo':
                                            if data["Event"] == "AccelerometerEvent":
                                                x = data["Data"]["X"]
                                                y = data["Data"]["Y"]
                                                z = data["Data"]["Z"]
                                                magnitude = data["Data"]["Magnitude"]
                                                self.handleMyoAccelemerometer(x, y, z, magnitude)
                                    
Show Python

Myo Gyroscope Event → Dictionary → {

  • "Myo Name" : String

  • "Event" : String → "GyroscopeEvent"

  • "Data" : Dictionary → {

    • "X" : Float

    • "Y" : Float

    • "Z" : Float

    • "Magnitude" : Float

    }

}


When gyroscope data is received, extract it and pass it to a function which will make use of the input accordingly.

                                    def forceServerDidReceiveData(self, deviceName, senderTag, data):
                                        if senderTag == 'Myo':
                                            if data["Event"] == "GyroscopeEvent":
                                                x = data["Data"]["X"]
                                                y = data["Data"]["Y"]
                                                z = data["Data"]["Z"]
                                                magnitude = data["Data"]["Magnitude"]
                                                self.handleMyoGyroscope(x, y, z, magnitude)
                                    
Show Python

Myo Orientation Event → Dictionary → {

  • "Myo Name" : String

  • "Event" : String → "OrientationEvent"

  • "Data" : Dictionary → {

    • "Roll" : Float

    • "Pitch" : Float

    • "Yaw" : Float

    }

}



When orientation data is received, extract it and pass it to a function which will make use of the input accordingly.

                                    def forceServerDidReceiveData(self, deviceName, senderTag, data):
                                        if senderTag == 'Myo':
                                            if data["Event"] == "OrientationEvent":
                                                roll = data["Data"]["Roll"]
                                                pitch = data["Data"]["Pitch"]
                                                yaw = data["Data"]["Yaw"]
                                                self.handleMyoOrientation(roll, pitch, yaw)
                                    
Show Python

Myo EMG Data → Dictionary → {

  • "Myo Name" : String

  • "Event" : String → "EMG"

  • "Data" : Array → [

    • [0] : Float

    • [1] : Float

    • [2] : Float

    • [3] : Float

    • [4] : Float

    • [5] : Float

    • [6] : Float

    • [7] : Float

    ]

}

When EMG data is received, extract it and pass it to a function which will make use of the input accordingly.

                                    def forceServerDidReceiveData(self, deviceName, senderTag, data):
                                        if senderTag == 'Myo':
                                            if data["Event"] == "EMG":
                                                emg0 = data["Data"][0]
                                                emg1 = data["Data"][1]
                                                emg2 = data["Data"][2]
                                                emg3 = data["Data"][3]
                                                emg4 = data["Data"][4]
                                                emg5 = data["Data"][5]
                                                emg6 = data["Data"][6]
                                                emg7 = data["Data"][7]
                                                self.handleMyoEMG(emg0, emg1, emg2, emg3, emg4, emg5, emg6, emg7)
                                    
Show Python

Myo Synced → Dictionary → {

  • "Myo Name" : String

  • "Event" : String → "Synced"

  • "Data" : Dictionary → {

    • "Arm" : String → "Right" | "Left"

    • "Direction" : String → "Towards Wrist" | "Towards Elbow"

    }

}

When the armband is synced with the device, use the sync data to identify which arm this Myo is on for later usage.
Note that the sync data is always sent to server whenever the device connects to it.

                                    def forceServerDidReceiveData(self, deviceName, senderTag, data):
                                        if senderTag == 'Myo':
                                                if data["Event"] == "Synced":
                                                    # Short Method
                                                    self.isMyoOnRight = True if data["Data"]["Arm"] == "Right" else False

                                                    # Long Method
                                                   if data["Data"]["Arm"] == "Right":
                                                        self.isMyoOnRight = True
                                                    else:
                                                        self.isMyoOnRight = False
                                    
Show Python

Myo Pose Event → Dictionary → {

  • "Myo Name" : String

  • "Event" : String → "Pose"

  • "Data" : String → "Unknown" | "Rest" | "Fist" | "Fingers Spread" | "Double Tap" | "Wave In" | "Wave Out"

}

Make use of the knowledge of which side the Myo is on (from the sync) to determine which way the hand is pointing and move the robot accordingly.

                                    def forceServerDidReceiveData(self, deviceName, senderTag, data):
                                        if senderTag == 'Myo':
                                                if data["Event"] == "Pose":
                                                    if data["Data"] == "Wave In":
                                                        if self.isMyoOnRight:
                                                            self.moveLeft()
                                                        else:
                                                            self.moveRight()
                                    
Show Python

Note that a tile's tag is always sent to the server for identification purposes.

Usage Demo

Click the Show Python buttons above to see a usage demo for each type of input from a Myo Armband.