Sensor Integration
Section titled “Sensor Integration”Learn how to integrate custom sensors into the JuHai USV system.
Sensor Interface
Section titled “Sensor Interface”Define Sensor Driver
Section titled “Define Sensor Driver”from jhusv.sensors import Sensor
class CustomSensor(Sensor): def __init__(self, port="/dev/ttyUSB0"): super().__init__( name="custom_sensor", sensor_type="environmental" ) self.port = port
def connect(self): """Connect to sensor""" # Initialize connection pass
def read(self): """Read sensor data""" # Read and return data return { "parameter1": value1, "parameter2": value2 }
def calibrate(self): """Calibrate sensor""" passRegister Sensor
Section titled “Register Sensor”from jhusv import SensorManager
manager = SensorManager()manager.register_sensor(CustomSensor(port="/dev/ttyUSB0"))Data Processing
Section titled “Data Processing”Sensor data is automatically stored in the database. You can configure sampling rate, data format, and other parameters.
See Hardware Overview for supported sensor types.