Supporting Tools API Reference

rviz_marker.pose_tools module

rviz_marker.pose_tools.in_region(point: list, bbox_as_list: list) bool

Test if the point (x, y) or (x, y, z) is in the bbox

Parameters:
  • point (list of 2 or 3 numbers) – the (x, y) or (x, y, z) value of the point

  • bbox_as_list ((x1, y1, x2, y2) or (x1, y1, z1, x2, y2, z2)) – the bounding square or bounding box

Returns:

True if the point is within the bbox

Return type:

bool

rviz_marker.pose_tools.list_to_pose(pose) geometry_msgs.msg.Pose

Convert a pose in xyzrpy or xyzq format to Pose

Parameters:

pose – s pose in a list format of xyzrpy or xyzq

Returns:

a Pose object with the same pose

rviz_marker.pose_tools.list_to_pose_stamped(pose, frame) geometry_msgs.msg.PoseStamped

Convert a pose in xyzrpy or xyzq format in a reference frame to PoseStamped

Parameters:
  • pose – a pose in a list format of xyzrpy or xyzq

  • frame – the reference frame of type str

Returns:

a Pose object with the same pose

rviz_marker.pose_tools.list_to_xyzq(pose) list

Convert a pose in xyzrpy or xyzq format to xyzq format

Parameters:

pose – a pose in a list format of xyzrpy or xyzq

Returns:

a list of the format xyzqqqq with the same pose

rviz_marker.pose_tools.list_to_xyzrpy(pose) list

Convert a pose in xyzrpy or xyzq format to xyzrpy format

Parameters:

pose – a pose in a list format of xyzrpy or xyzq

Returns:

a list of the format xyzrpy with the same pose

rviz_marker.pose_tools.overlap_regions(bbox1_as_list, bbox2_as_list)

Test if two regions, 2d or 3d as bbox, are overlapped

Parameters:
  • bbox1_as_list – the bounding square or bounding box

  • bbox2_as_list – the bounding square or bounding box

Returns:

True of the two regions are overlapped

rviz_marker.pose_tools.pose_stamped_to_point_stamped(pose_stamped: geometry_msgs.msg.PoseStamped) geometry_msgs.msg.PointStamped

Convert a PoseStamped object into PointStamped object

rviz_marker.pose_tools.pose_stamped_to_transform_stamped(pose_stamped: geometry_msgs.msg.PoseStamped, reference_frame: str) geometry_msgs.msg.TransformStamped

Convert a PoseStamped object into TransformStamped object

rviz_marker.pose_tools.pose_to_xyzq(pose) list

Convert a pose in Pose or PoseStamped format to xyzq format

Parameters:

pose – the pose of type Pose or PoseStamped

Returns:

a list of the format xyzqqqq with the same pose

rviz_marker.pose_tools.pose_to_xyzrpy(pose) list

Convert a pose in Pose or PoseStamped format into xyzrpy format

Parameters:

pose – the pose of type Pose or PoseStamped

Returns:

a list of the format xyzrpy with the same pose

rviz_marker.pose_tools.same_joint_values_with_tolerence(joint_values_1: list, joint_values_2: list, tolerance: float = 0.1) bool

Test if the two sets of joint values are the same

Parameters:
  • joint_values_1 (list) – the first set of joint_values

  • joint_values_2 (list) – the second set of joint values

  • tolerance (float) – the absolute tolerance for the comparison

Returns:

True if the two sets of joint values are deemed the same

Return type:

bool

rviz_marker.pose_tools.same_pose_with_tolerence(pose_1, pose_2, tolerance: float = 0.01) bool

Test if two poses are the same within a tolerance of each other.

Parameters:
  • goal (A list of floats or a Pose) – A pose

  • actual (A list of floats or a Pose) – another pose

  • tolerance (float) – the absolute tolerance for the comparison

Returns:

True if the goal and actual are the same

Return type:

bool

rviz_marker.pose_tools.same_rpy_with_tolerence(rpy_1: list, rpy_2: list, tolerance: float = 0.01) bool

Test if two euler’s angles are the same

Parameters:
  • rpy_1 (list) – the first orientation in euler’s angle

  • rpy_2 (list) – the second orientation in euler’s angle

  • tolerance (float) – the absolute tolerance for the comparison

Returns:

True if the two orientations are deemed the same

Return type:

bool

rviz_marker.pose_tools.same_xyz_with_tolerence(xyz_1: list, xyz_2: list, tolerance: float = 0.01) bool

Test if two positions are the same

Parameters:
  • xyz_1 (list) – the first position in xyz

  • xyz_2 (list) – the second position in xyz

  • tolerance (float) – the absolute tolerance for the comparison

Returns:

True if the two orientations are deemed the same

Return type:

bool

rviz_marker.pose_tools.transform_to_pose_stamped(transform: geometry_msgs.msg.TransformStamped) geometry_msgs.msg.PoseStamped

Convert a TransformStamped object into PoseStamped object

rviz_marker.rospkg module

class rviz_marker.rospkg_tools.PackageFile

Bases: object

The class provides tools for dealing with the uri for ros resource retriever

resolve_to_file_or_http_uri() str

Converts a uri or a file path into a uri starting with file:// or http://

Parameters:

uri_or_path (str) – a file, package or http uri or a full or package relative file path

Returns:

the file prototcol uri

Return type:

str

Raise:

Exception if the parameter is of an invalid format

resolve_to_file_uri() str

Converts a uri or a file path into a uri starting with file://

Parameters:

uri_or_path (str) – a file, package or http uri or a full or package relative file path

Returns:

the file prototcol uri of type str

Raise:

Exception if the parameter is of an invalid format

resolve_to_path() str

Converts a uri or a file path into a full local file path

Parameters:

uri_or_path (str) – a file, package or http uri or a full or package relative file path

Returns:

the absolute file path

Return type:

str

Raise:

Exception if the parameter is of an invalid format

rviz_marker.logging_tools module

class rviz_marker.logging_tools.CustomFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)

Bases: Formatter

The custom logger class for the package :meta private:

FORMATS = {10: '\x1b[36;20m[%(levelname)s] [%(created)16f]: %(message)s\x1b[0m', 20: '\x1b[38;20m[%(levelname)s] [%(created)16f]: %(message)s\x1b[0m', 30: '\x1b[33;20m[%(levelname)s] [%(created)16f]: %(message)s\x1b[0m', 40: '\x1b[31;20m[%(levelname)s] [%(created)16f]: %(message)s\x1b[0m', 50: '\x1b[31;1m[%(levelname)s] [%(created)16f]: %(message)s\x1b[0m'}
bold_red = '\x1b[31;1m'
cyan = '\x1b[36;20m'
format(record)

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

formatException(exc_info)

Format and return the specified exception information as a string.

This default implementation just uses traceback.print_exception()

grey = '\x1b[38;20m'
red = '\x1b[31;20m'
reset = '\x1b[0m'
yellow = '\x1b[33;20m'
rviz_marker.logging_tools.init_logger()
rviz_marker.logging_tools.spin()