brian.sensors.sensor_port_probe
AutoDetect class objects
NOT_CONNECTED
ANALOG_P1
ANALOG_P1_HACKER
Force P1 ADC mode, regardless of what AD thinks
ANALOG_P6
ANALOG_P6_HACKER
Force P6 ADC mode, regardless of what AD thinks
I2C_9K6
NXT ultrasonic uses bit banging I2C implementation and cannot operate faster than 9600 bits/s
I2C_100K
Some other 3rd party sensors may support only standard I2C speed
I2C_400K
Most other 3rd party sensors support fast I2C speeds
UART_2400
UART_9600
UART_115K
115200 baud
UART_MULTI_BRIAN_MASTER
UART_MULTI_BRIAN_SLAVE
Slave has uart RX/TX pins swapped
PROTOCOL_UART_EV3
PROTOCOL_I2C_NXT_REG
ERROR
SensorInfo class objects
i2c protocol specifies type as 8char string; uart ev3 as a single byte 0-255 when uart ev3 protocol is used, the name can be something like: "Uart 39" and the code will contain the actual value when i2c protocol is used, the code can be = 0
sensor_type_name
sensor_type_code
selected_mode
mode_name
mode_count
Set by sensor handler. EV3 sensors report their mode count. Generic I2C sensor will have 0. Specific I2C sensors (NXT US) will have constant mode count. Even analog sensor, such as NXT light can have multiple modes and mode count - active, passive, blinking differential handled by ST code
unit_name
raw_min
raw_max
pct_min
pct_max
si_min
Scaled International (SI) value corresponding to the minimum raw value.
si_max
Scaled International (SI) value corresponding to the maximum raw value.
SensorPortProbe class objects
is_sensor_api_handler_registered
is_connected
auto_detect
auto_detect_hint
info
probe_sensor
Return latest read-only information about a sensor connected to a given port. This method can be called
any time (regardless of registered Sensor port handler or if it is not registered)
Arguments:
port
: sensor port to probe.
Returns:
information about the current port usage
probe_sensor_with_autodetect_hint
Return latest read-only information about a sensor connected to a given port.
It requests a specific handling of the sensor, based on the autodetect hint. The hint may be used to initialize a specific software protocol over a detected bus (e.g. use EV3 UART protocol if the detected sensor interfaces using UART). When you expect a specific class of sensors to be connected, this may be useful to extract more information, for example about the sensor modes. This method can be used only, when there is no Sensor handler registered.
Arguments:
port
: sensor port to probe.hint
: hint to for autodetect (e.g. software protocol over detected hw bus)
Raises:
SensorPortAlreadyInUse
: When trying to probe port that is already in use.
Returns:
information about the current port usage
reboot
Turn off power to the port and turn it back on. This will forcibly reboot the sensor.
The powered-down state lasts about 100ms. In case of some (mostly digital) sensors, there can be some additional time (~1s or more) to boot up and process connection handshake with Brian. This method can be used only, when there is no Sensor handler registered. When there is, use the method in the Sensor handler itself.
Arguments:
port
: sensor port to force reboot.