MagneticSensor
robodyno.components.can_bus.magnetic_sensor
Magnetic sensor driver
The magnetic guide sensor can be used to get the position status.
Examples:
>>> from robodyno.components import MagneticSensor
>>> from robodyno.interfaces import CanBus
>>> can = CanBus()
>>> mag = MagneticSensor(can)
>>> print(mag.get_position_status())
[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0]
MagneticSensor
Bases: CanBusDevice
Magnetic sensor driver
Attributes:
Name | Type | Description |
---|---|---|
id(int) |
Device id. |
__init__(can, id_=2)
Initializes the magnetic sensor driver.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
can(CanBus) |
Can bus instance. |
required | |
id_(int) |
Device id. |
required |
get_position_status(timeout=None)
Reads the magnetic sensor position status.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout |
float
|
Timeout in seconds. |
None
|
Returns:
Type | Description |
---|---|
list | None
|
The position status value read by the magnetic sensor. |
Optional[list]
|
Contains a list of 16 position status |
calibrate_magnetic_field()
In the new environment, magnetic sensors need to be calibrated.