zlp_coordinate_system module

This module contains utility classes and methods which ease the management and operation of reference systems.

class z_laser_zlp1.zlp_coordinate_system.CoordinateSystem(projector_id, module_id, thrift_client)[source]

Bases: object

This class implement the functions related with coordinate systems management.

Parameters:
  • projector_id (str) – serial number of the projector
  • module_id (str) – function module identification name
  • thrift_client (object) – object with the generated client to communicate with the projector
projector_id

serial number of the projector

Type:str
module_id

function module identification name

Type:str
reference_object_list

list of created reference objects

Type:list
__init__(projector_id, module_id, thrift_client)[source]

Initialize the CoordinateSystem object.

coordinate_system_list()[source]

Get list of defined coordinate systems from projector.

Returns:the first value in the returned tuple is a names’ list of available coordinate systems, the second is a bool success value and the third value in the tuple is an information message string
Return type:tuple[list, bool, str]
create_reference_object()[source]

Generate new reference object.

Returns:reference object struct fields initialized
Return type:object
create_reference_point(name, x, y, z=0, active=True)[source]

Generate new reference point.

Parameters:
  • name (str) – reference point name
  • x (float) – x position value
  • y (float) – y position value
  • z (float) – z position value
  • active (bool) – activate reference point parameter
Returns:

reference point struct fields initialized

Return type:

object

define_cs(cs, do_target_search)[source]

Generate new coordinate system.

Parameters:
  • cs (object) – object with the necessary parameters to definea a new coordinate system
  • do_target_search (bool) – true if scan targets, false otherwise
Returns:

the first value in the returned tuple is a bool success value, the second is an information message string and the third value an object with the properties of the new coordinate system defined

Return type:

tuple[str, bool, object]

update_cs(cs, scan_result)[source]

Update coordinate system with the results of scanned targets.

Parameters:
  • cs (object) – object with the original parameters of the coordinate system
  • scan_result (object) – object with the parameters of the scanned targets
Returns:

object with the updated parameters of the coordinate system

Return type:

object

function_module_changed_callback(module_id, old_state, new_state)[source]

Callback for function module state change, events handler. It is used for stopping running code while until the projector ends scanning targets.

Parameters:
  • module_id (str) – function module identificator name
  • old_state (str) – old state of the function module
  • new_state (str) – new state of the function module
scan_targets(ref_obj_name)[source]

Projector automatic scanning of the targets placed on the projection surface.

Parameters:ref_obj_name (str) – object with the necessary parameters to create the coordinate system
Returns:the first value in the returned tuple is a bool success value, the second value is an information message string and the third is a list with the results of the scanned targets
Return type:tuple[bool, str, list]
register_cs(cs_name)[source]

Register a new coordinate system at the projector after it has been defined.

Parameters:cs_name (str) – name of the coordinate system
Returns:the first value in the returned tuple is a bool success value and the second value in the tuple is an information message string
Return type:tuple[bool, str]
set_cs(cs_name)[source]

Activate the new defined coordinate system and deactivate the other existing coordinate systems at the projector.

Parameters:cs_name (str) – name of the new coordinate system
Returns:the first value in the returned tuple is a bool success value and the second value in the tuple is an information message string
Return type:tuple[bool, str]
show_cs(cs_name)[source]

Project a coordinate system on the projection surface.

Parameters:cs_name (str) – name of the coordinate system
Returns:the first value in the returned tuple is a bool success value and the second value in the tuple is an information message string
Return type:tuple[bool, str]
hide_cs(cs_name)[source]

Project a coordinate system on the projection surface.

Parameters:cs_name (str) – name of the coordinate system
Returns:the first value in the returned tuple is a bool success value and the second value in the tuple is an information message string
Return type:tuple[bool, str]
remove_cs(cs_name)[source]

Delete a coordinate system.

Parameters:cs_name (str) – name of the coordinate system
Returns:the first value in the returned tuple is a bool success value and the second value in the tuple is an information message string
Return type:tuple[bool, str]
get_cs(cs_name, cs_params)[source]

Get the parameters values of a defined coordinate system.

Parameters:cs_name (str) – name of the coordinate system
Returns:the first value in the returned tuple is an object with the coordinate system parameters values, the second is a bool success value and the third value in the tuple is an information message string
Return type:tuple[object, bool, str]
_CoordinateSystem__define_reference_point(reference_object, cross_size, n, d, x, y)

Fill other fields of the coordinate system object.

Parameters:
  • reference_object (object) – object of the coordinate system
  • cross_size (object) – object with the dimensions of the crosses
  • n (int) – vector index
  • d (float) – distance between the projection surface and the projector
  • x (float) – value of the x-axis coordinate
  • y (float) – value of the y-axis coordinate
Returns:

parameters of the coordinate system object updated

Return type:

object

_CoordinateSystem__ref_obj_state(state, ref_obj)

Activate or deactivate a reference object.

Parameters:
  • state (bool) – true if activate, false otherwise
  • reference_object (object) – reference object to be activated or deactivated