Maskbits¶
All statuses in jaeger are expressed as classes that subclass from enum.IntFlag
. This allows them to behave as a series of values that can be combined with bitwise operations while also containing a representation of the name associated with a bit. IntFlag
objects are ultimately just integers and can be used as such
>>> dat_init = PositionerStatusV4_1.DATUM_INITIALIZED
>>> dat_init
<PositionerStatusV4_1.DATUM_INITIALIZED: 536870912>
>>> dat_init.name
'DATUM_INITIALIZED'
>>> int(dat_init)
536870912
>>> isinstance(dat_init, int)
True
To create a new enumeration from an integer
>>> PositionerStatusV4_1(117440512)
<PositionerStatusV4_1.BETA_DISPLACEMENT_COMPLETED|ALPHA_DISPLACEMENT_COMPLETED|DISPLACEMENT_COMPLETED: 117440512>
Enumerations can be combined using bitwise operations
>>> status = PositionerStatusV4_1.DATUM_INITIALIZED | PositionerStatusV4_1.SYSTEM_INITIALIZED
<PositionerStatusV4_1.DATUM_INITIALIZED|SYSTEM_INITIALIZED: 536870913>
>>> status.active_bits
[<PositionerStatusV4_1.SYSTEM_INITIALIZED: 1>,
<PositionerStatusV4_1.DATUM_INITIALIZED: 536870912>]
>>> status & PositionerStatusV4_1.ALPHA_DISPLACEMENT_COMPLETED
<PositionerStatusV4_1.0: 0>
Maskbits API¶
-
class
jaeger.maskbits.
Maskbit
(value)[source]¶ Bases:
enum.IntFlag
A maskbit enumeration. Intended for subclassing.
-
property
version
¶ The version of the flags.
-
property
active_bits
¶ Returns a list of flags that match the value.
-
property
-
jaeger.maskbits.
PositionerStatus
¶ Alias to the default positioner status flags.
alias of
jaeger.maskbits.PositionerStatusV4_1
-
class
jaeger.maskbits.
CommandStatus
(value)[source]¶ Bases:
jaeger.maskbits.Maskbit
Maskbits for command status.
-
DONE
= 1¶
-
CANCELLED
= 2¶
-
FAILED
= 4¶
-
READY
= 8¶
-
RUNNING
= 16¶
-
TIMEDOUT
= 32¶
-
property
is_done
¶ Returns True if the command is done (completed or failed).
-
property
is_running
¶ Returns True if the command is running.
-
property
failed
¶ Returns True if the command failed (or got cancelled).
-
property
timed_out
¶ Returns True if the command timed out.
-
-
class
jaeger.maskbits.
ResponseCode
(value)[source]¶ Bases:
enum.IntFlag
Maskbit for the status of the bootloader.
0: All OK
1: Received parameter is out of range
2: Trajectory not accepted
3: Already in motion, cannot accept command
4: Datum not initialized
5: Incorrect amount of data in packet
6: One of the calibration modes is active:
MOTOR_CALIBRATION
,COGGING_CALIBRATION
,DATUM_CALIBRATION
,DATUM _INITIALIZATION
7: The motors are not calibrated and therefore the hall sensors can’t be used
8: A collision is detected, the flag has to be first cleared with stop trajectory
9: Hall sensors are disabled and can therefore not be used
10: Broadcast command not valid
11: Command not supported by bootloader
12: Invalid command
13: Unknown command
14: Datum not calibrated
15: Halls sensors have been disabled
-
COMMAND_ACCEPTED
= 0¶
-
VALUE_OUT_OF_RANGE
= 1¶
-
INVALID_TRAJECTORY
= 2¶
-
ALREADY_IN_MOTION
= 3¶
-
DATUM_NOT_INITIALIZED
= 4¶
-
INCORRECT_AMOUNT_OF_DATA
= 5¶
-
CALIBRATION_MODE_ACTIVE
= 6¶
-
MOTOR_NOT_CALIBRATED
= 7¶
-
COLLISION_DETECTED
= 8¶
-
HALL_SENSOR_DISABLED
= 9¶
-
INVALID_BROADCAST_COMMAND
= 10¶
-
INVALID_BOOTLOADER_COMMAND
= 11¶
-
INVALID_COMMAND
= 12¶
-
UNKNOWN_COMMAND
= 13¶
-
DATUM_NOT_CALIBRATED
= 14¶
-
HALL_SENSORS_DISABLED
= 15¶
-
class
jaeger.maskbits.
BootloaderStatus
(value)[source]¶ Bases:
jaeger.maskbits.Maskbit
Maskbits for positioner status when in bootloader mode.
-
BOOTLOADER_INIT
= 1¶
-
BOOTLOADER_TIMEOUT
= 2¶
-
BSETTINGS_CHANGED
= 512¶
-
RECEIVING_NEW_FIRMWARE
= 65536¶
-
NEW_FIRMWARE_RECEIVED
= 16777216¶
-
NEW_FIRMWARE_CHECK_OK
= 33554432¶
-
NEW_FIRMWARE_CHECK_BAD
= 67108864¶
-
UNKNOWN
= 1073741824¶
-