philander.fastgait package

Submodules

philander.fastgait.actorunit module

A module for the FastGait ActorUnit driver implementations.

In case of FOG, the ActorUnit is alerted via BlueTooth and starts vibrating in pulses, giving the patient a tactile cueing impulse.

class ActorUnit[source]

Bases: BLE, Actuator, Configurable

Implementation of the vibration belt driver, also called ActorUnit.

CHARACTERISTIC_UUID = '0000fa61-0000-1000-8000-00805f9b34fb'
CLIENT_NAME = 'FastGait AU'
CMDBUF_GET_DEFAULT = bytearray(b'\x04')

Command buffer to retrieve default vibration parameters.

CMDBUF_START_DEFAULT = bytearray(b'\x05')

Complete command buffer to start vibration using the default parameter set.

CMDBUF_STOP = bytearray(b'\x02')

Command buffer to stop vibration.

CMD_GET_DEFAULT = 4

Retrieve current default configuration:

CMD_SET_DEFAULT = 3

Configure default vibration parameters.

CMD_START = 1

Command to start a vibration as specified by further parameters.

CMD_START_DEFAULT = 5

Start vibration as specified by the default parameters.

CMD_STOP = 2

Command to immediately stop vibration.

classmethod Params_init(paramDict)[source]

Initialize parameters with their defaults.

The following settings are supported:

Key name

Value type, meaning and default

ActorUnit.delay

int [0…65535] Initial delay in ms; DELAY_DEFAULT

ActorUnit.pulsePeriod

int [0…65535] Length of one period in ms; PULSE_PERIOD_DEFAULT

ActorUnit.pulseOn

int [0…pulsePeriod] Length of the active part in that period in ms; PULSE_ON_DEFAULT

ActorUnit.pulseCount

int [0…255] Number of pulses. Zero (0) means infinite pulses. PULSE_COUNT_DEFAULT

ActorUnit.pulseIntensity

int [0…100] Intensity of the pulses given as a percentage %. PULSE_INTENSITY_DEFAULT

ActorUnit.motors

Motors to be used for the pulses [0…3] meaning none, left, right, both motors; MOTORS_DEFAULT

All other BLE.* settings as documented at BLE.Params_init().

Also see: Module.Params_init().

Parameters:

paramDict (dict(str, object)) – The configuration dictionary.

Returns:

none

Return type:

None

action(pattern=None)[source]

Executes a predefined action or movement pattern with this actuator.

Parameters:

pattern (int) – The action pattern to execute.

Returns:

An error code indicating either success or the reason of failure.

Return type:

ErrorCode

configure(configData)[source]

Re-configures the driver’s default vibration parameters.

Parameters:

configData (.actorunit.Configuration) – The configuration to apply.

Returns:

An error code indicating either success or the reason of failure.

Return type:

ErrorCode

getDefault()[source]

Retrieve default configuration from the remote client unit.

Returns:

The configuration and an error code indicating either success or the reason of failure.

Return type:

Configuration, ErrorCode

open(paramDict)[source]

Initialize an instance and prepare it for use.

Also see: Module.open().

Parameters:

paramDict (dict(str, object)) – Configuration parameters as possibly obtained from Params_init().

Returns:

An error code indicating either success or the reason of failure.

Return type:

ErrorCode

setDefault(newDefault: Configuration)[source]

Store default configuration onto the remote client unit.

Parameters:

newDefault – The configuration to store as the new default.

Returns:

An error code indicating either success or the reason of failure.

Return type:

ErrorCode

startOperation(direction=Direction.positive, strengthIntensity=None, onSpeedDuty=None, ctrlInterval=None, durationLengthCycles=None)[source]

Issue a start command to the actuator unit.

Make the actor unit start cueing.

Returns:

An error code indicating either success or the reason of failure.

Return type:

ErrorCode

stopOperation()[source]

Issue a stop command to the actuator unit.

Returns:

An error code indicating either success or the reason of failure.

Return type:

ErrorCode

class Configuration(type: ConfigItem, value: int = 1, fifo: CfgFifo = None, onDuration: int = 120, period: int = 200, delay: int = 0, numPulses: int = 3, intensity: int = 80, motors: int = Motor.ALL, resetTimer: int = TimerControl.RESET)[source]

Bases: Configuration

Data class to represent a (default) configuration of the ActorUnit.

Pulses are emitted periodically in rectangle form and the low-level API allows to configure: - the length of one period, - the length of the on-part, - an initial delay and - the number of periods to run.

            |< PULSE ON >|
            _____________       _____________       ______     ON
 ...........|            |______|            |______|     ...  OFF
|<  DELAY  >|<      PERIOD     >|
delay: int = 0

Wait time before the first interval, specified in milliseconds.

intensity: int = 80

Intensity of the vibration [0…100].

motors: int = 3

Motor(s) to use for vibration. 0=none, 1=left, 2=right, 3=both.

numPulses: int = 3

Number of repetitions. Zero means infinitely.

onDuration: int = 120

Length of the duty cycle, given in milliseconds.

period: int = 200

Total length of each interval in milliseconds. Must be larger than the onDuration.

resetTimer: int = 1

Whether or not to reset the pulse timer. 0=keep, 1=reset.

class Default[source]

Bases: object

Container for default values that are not part of any other data structure.

FIRST_DELAY = 0

Delay of the first pulse, given in milliseconds 0…65535 (0xFFFF). Zero (0) to start immediately.

PULSE_COUNT = 3

Total number of pulses 0…255. Zero (0) means infinitely.

PULSE_ON_DURATION = 120

Pulse ON duration in milliseconds 0…65535 (0xFFFF). Must be less than the period.

PULSE_PERIOD = 200

Pulse period in milliseconds 0…65535 (0xFFFF).

class Event(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Data class to represent events emitted by the ActorUnit.

cueStandard = 1
cueStop = 2
class Intensity[source]

Bases: Percentage

Structure to reflect the intensity that the vibration motors run on.

DEFAULT = 80

The default intensity.

MAX = 100

Maximum possible intensity.

MEDIUM = 50

Medium vibration intensity.

MIN = 0

Minimal intensity.

OFF = 0

Least possible intensity, actually no vibration.

STRONG = 80

Strong intensity.

WEAK = 20

Weak intensity.

class Motor(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

Motor selection used for vibration: Motor #1, or #2 or both.

ALL = 3

Mnemonics for all motors

DEFAULT = 3

Default motor selection.

NONE = 0

Mnemonics for no actuator

ONE = 1

First actuator

TWO = 2

Second actuator

class TimerControl(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Structure to reflect the timer control setting as part of a vibration command

DEFAULT = 1

Default timer control value.

KEEP = 0

Keep the current timer setting.

RESET = 1

Reset the timer.

philander.fastgait.sysman module

A module for the FastGait system management implementation.

Module contents

A package to provide modules related to the FastGait project.

FastGait was a research project at IHP from 2019 to 2022 targeting a foot-warn mobile system to assist patients suffering from Parkinson’s disease. In particular, the system is to detect and overcome freeze-of- gait (FOG) situations.

For more information on the FastGait project see: IHP project website.