zlp_utils module

Complementary module with useful classes to support the usage of zlp libraries.

class z_laser_zlp1.zlp_utils.UserT(x0, y0, resolution, size_horiz, size_vert)[source]

Bases: object

This class provides a method to calculate the user points T1, T2, T3 from T0 and the properties of the reference system.

Parameters:
  • x0 (float) – x-position of the user T0 point
  • y0 (float) – y-position of the user T0 point
  • resolution (float) – resolution of the user reference system {T}
  • size_horiz (float) – horizontal dimension of the refence system in real dimensions {P}
  • size_vert (float) – vertical size of the refence system in real dimensions {P}
T

list of the calculated user {T} points

Type:list
__init__(x0, y0, resolution, size_horiz, size_vert)[source]

Initialize the UserT object.

class z_laser_zlp1.zlp_utils.CoordinateSystemParameters[source]

Bases: object

This class is used as data object with the necessary parameters to define a coordinate system.

DEFAULT_SHOW_TIME

number of seconds for projecting reference system’s projection elements

Type:int
name

reference system name

Type:str
distance

distance between the projection surface and the projector device

Type:float
resolution

resolution of user reference system {T}

Type:float
P

list with the x,y,z position of reference points from projector reference system {P}

Type:list
T

list with the x,y,z position of user reference points from user reference system {T}

Type:list
DEFAULT_SHOW_TIME = 1
__init__()[source]

Initialize the CoordinateSystemParameters object.

static req_to_param(req)[source]

Convert ROS request object to CoordinateSystemParameters object.

Parameters:req (object) – ROS request object with the parameters of a coordinate system
Returns:same parameters of the coordinate system now in a CoordinateSystemParameters object
Return type:object
static param_to_req(params)[source]

Convert CoordinateSystemParameters object to ROS request object.

Parameters:params (object) – CoordinateSystemParameters object with the parameters of a coordinate system
Returns:same parameters of the coordinate system now in a ROS request object
Return type:object
class z_laser_zlp1.zlp_utils.ProjectionElementParameters[source]

Bases: object

This class is used as data object with the necessary information to create a projection element.

figures_list

list with the projection elements’ identificator names

Type:list
figure_type

projection element id (see Figure.msg for more information)

Type:int
projection_group

name of the projection group to which the projection element belongs

Type:str
figure_name

name of the projection element to define

Type:str
position

object with the x,y,z position of the projection element’s characteristic point

Type:object
size

list with the characteristic sizes of the projection element

Type:list
angle

list with the characteristic angles of the projection element

Type:list
text

text character string for text projection element

Type:str
figures_list = ['/polyline/', '/circle/', '/arc/', '/oval/', '/text/', '/pointer/']
__init__()[source]

Initialize the ProjectionElementParameters object.

to_figure()[source]

Return ProjectionElementParameters attributes converted to ROS msg format.

Returns:ROS msg object with the parameters of the projection element
Return type:object
class z_laser_zlp1.zlp_utils.GeometryTool(thrift_client)[source]

Bases: object

This class implement functions to generate basic geometry and math tools.

Parameters:thrift_client (object) – object with the generated client to communicate with the projector
__init__(thrift_client)[source]

Initialize the GeometryTool object.

create_matrix4x4()[source]

Initialize 4x4 matrix.

Returns:matrix object initialized with empty values
Return type:object
create_2d_point(x=0, y=0)[source]

Initialize 2-dimension array.

Parameters:
  • x (float) – x position value
  • y (float) – y position value
Returns:

object with the values of the 2 axes (x,y)

Return type:

object

create_3d_point(x=0, y=0, z=0)[source]

Initialize 3-dimension array.

Parameters:
  • x (float) – x position value
  • y (float) – y position value
  • z (float) – z position value
Returns:

object with the values of the 3 axes (x,y,z)

Return type:

object

static vector_point_distance(point1, point2)[source]

Return the euclidean distance between 2 points.

Parameters:
  • point1 (list) – x,y,z position of the first point
  • point2 (list) – x,y,z position of the second point
Returns:

euclidean distance between point1 and point2

Return type:

float

static vector_point_angle(point1, point2)[source]

Angle of the vector consisting in two points, regards to the horizontal 0 degrees.

Parameters:
  • point1 (list) – x,y,z position of the first point of the vector
  • point2 (list) – x,y,z position of the second point of the vector
Returns:

vector angle regards to the horizontal 0 degrees

Return type:

float