PosConCM
- class compas_fab.sensors.PosConCM(serial, address)[source]
Bases:
SerialSensor
Provides an interface for the Baumer PosConCM round objects measurement sensor.
The sensor has different interfaces to retrieve its data. This class provides access to the serial interface (RS-485). This class is a context manager type, so it’s best used in combination with the
with
statement to ensure resource deallocation. The protocol of the sensor when operated via RS-485 indicates that access to it must be locked programmatically before starting operations and unlocked on completion. This is handled automatically if you use this class on awith
statement, otherwise, the methodsbegin()
andend()
must be invoked by hand.- Attributes
serial (
serial.Serial
) – Instance of the serial port used to communicate with the sensor.address (
int
) – PosConCM sensors have an address assigned, which defaults to 1. There’s also a broadcast address (PosConCM.BROADCAST_ADDRESS
) that can be used to query the address of the sensor connected to the RS-485 bus. Only one sensor can be in the bus when using the broadcast address to query for sensor’s address.
Examples
>>> from serial import Serial >>> with Serial('COM5', 57600, parity=PARITY_EVEN, timeout=1) as serial: >>> with PosConCM(serial, PosConCM.BROADCAST_ADDRESS) as broadcast_query: ... addr = broadcast_query.get_address() ... ... with PosConCM(serial, addr) as sensor: ... sensor.set_measurement_type('X-Center') ... sensor.set_precision(2) ... data = sensor.get_measurement()
Methods
Activates the FLEX Mount feature of the sensor to allow positioning it on an angled installation.
Adjusts the sensor to detect darker or lighter surfaces.
Locks the sensor to start RS-485 communication.
Checks that message is complete.
Deactivates the FLEX Mount feature.
Unlocks the sensor from RS-485 communication.
Formats the command.
Gets the address of the RS-485 sensors currently connected to the bus.
Retrieves the current measurement of the sensor according to the current settings.
Gets payload.
Resets the sensor to factory settings.
Sends a command to the sensor's address specified.
Sets the FLEX Mount feature to a specific angle and distance.
Defines the measurement type to use.
Defines the precision the sensor will use to determine edges:
Sets the FLEX Mount feature to a specific angle and distance.