Skip to content

brian.motors

brian

MotorException class objects

class MotorException(Exception)

Default motor Exception

MotorAlreadyClosedError class objects

class MotorAlreadyClosedError(MotorException)

Thrown when trying to access closed Motor

MotorInitializationFailedError class objects

class MotorInitializationFailedError(MotorException)

Thrown when motor initialization fails during init

MotorPortAlreadyInUse class objects

class MotorPortAlreadyInUse(MotorException)

Thrown when trying to register motor or motor probe with port mode to already used port

MotorIsNotReadyError class objects

class MotorIsNotReadyError(MotorException)

Thrown when trying to operate on a motor that is not ready.

This is the base class for motor readiness exceptions. Catching this exception will also catch MotorIncompatibleTypeError and MotorNotConnectedError.

MotorIncompatibleTypeError class objects

class MotorIncompatibleTypeError(MotorIsNotReadyError)

Thrown when a motor of a different type than expected is connected.

Catching this exception will also catch MotorNotConnectedError.

MotorNotConnectedError class objects

class MotorNotConnectedError(MotorIncompatibleTypeError)

Thrown when no motor is connected to the specified port.

Module-level functions

get_wait_until_timeout_ms

def get_wait_until_timeout_ms() -> int

Get the current timeout value for wait-until-ready operations in milliseconds.

set_wait_until_timeout_ms

def set_wait_until_timeout_ms(timeout_ms: int) -> None

Set the default timeout value for wait-until-ready operations in milliseconds.

This timeout is used by all motor operations that internally wait for the motor to be ready (for example current_angle, coast, rotate_by_angle, and so on).

Arguments:

  • timeout_ms: Timeout in milliseconds for internal wait-until-ready calls.
    • positive: wait up to that many milliseconds
    • 0 or negative: treated as no wait (immediate return from readiness waits)