PosCon3D

class compas_fab.sensors.baumer.PosCon3D(serial, address)[source]

Bases: compas_fab.sensors.base.SerialSensor

Provides an interface for the Baumer PosCon3D edge 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 a with statement, otherwise, the methods begin() and end() must be invoked by hand.

Attributes
  • serial (serial.Serial) – Instance of the serial port used to communicate with the sensor.

  • address (int) – PosCon3D sensors have an address assigned, which defaults to 1. There’s also a broadcast address (PosCon3D.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, timeout=1) as serial:                            
>>>     with PosCon3D(serial, PosCon3D.BROADCAST_ADDRESS) as broadcast_query:   
...         addr = broadcast_query.get_address()                                
...                                                                             
...     with PosCon3D(serial, addr) as sensor:                                  
...         sensor.set_measurement_type('Edge L rise')                          
...         sensor.set_precision(2)                                             
...         data = sensor.get_measurement()                                     

Methods

__init__(serial, address)

activate_flex_mount(reference_thickness)

Activates the FLEX Mount feature of the sensor to allow positioning it on an angled installation.

adjust_to_dark_object(is_dark_object)

Adjusts the sensor to detect darker or lighter surfaces.

begin()

Locks the sensor to start RS-485 communication.

calculate_checksum(command)

Checks that message is complete.

deactivate_flex_mount()

Deactivates the FLEX Mount feature.

end()

Unlocks the sensor from RS-485 communication.

format_command(address, command[, data])

Formats the command.

get_address()

Gets the address of the RS-485 sensors currently connected to the bus.

get_live_monitor_data()

Retrieves the distance to the surface in the center of the laser beam and the angle at which it's found.

get_measurement()

Retrieves the current measurement of the sensor according to the current settings.

get_payload(result)

Gets payload.

reset()

Resets the sensor to factory settings.

send_command(address, command[, data])

Sends a command to the sensor's address specified.

set_edge_height(height)

Defines the minimum height of an edge to be detected.

set_flex_mount(angle, distance)

Sets the FLEX Mount feature to a specific angle and distance.

set_measurement_type(measurement_type)

Defines the measurement type to use.

set_precision(precision)

Defines the precision the sensor will use to determine edges:

Attributes

BROADCAST_ADDRESS

ERROR_CODES

FRAME_HEAD

FRAME_TAIL

MEASUREMENT_TYPES

QUALITY