KOOSVisu

class mobrob_behcon.core.visualisation.KOOSVisu[source]

The class KOOSVisu

This class represents a visualization of the robot environment from a bird’s eye view. The different classes like Laser Scanner or Behaviour can draw on the canvas. Output is published as a video stream via a ROS Publisher.

Attributes

colours

Methods

__init__()

constructor

clear_image()

Clears the canvas.

draw_box(pt1, pt2[, color])

Draws a box on the canvas.

draw_cluster_points_laser(points, cluster_labels)

Draws a list of clustered points to canvas.

draw_cross_world(point[, color, size])

draw_crosses_world(lst_points[, color, size])

Draws a list of crosses to canvas.

draw_ellipse_world(point, covariance, sigma)

draw_line_world(slope, offset[, color])

draw_origin_world()

draw_point_laser(point[, color])

Draws a dot on canvas.

draw_point_world(point[, color])

Draws a dot on canvas.

draw_points_laser(lst_points[, color])

Draws a list of points to canvas.

draw_points_world(lst_points[, color])

Draws a list of points to canvas.

draw_robot([color])

Draws the robot on the canvas as rectangle with the given color.

send_image()

Sends out the canvas via the ROS publisher.

set_current_pose(current_pose)

Setter for robots current pose

to_visu_coord(point)

Converts a point in world coordinates to pixel coordinates on canvas.

Details

__init__()[source]

constructor

clear_image()[source]

Clears the canvas.

draw_box(pt1, pt2, color=(255, 0, 0))[source]

Draws a box on the canvas. Box is defined by two points in robot space.

Parameters
  • pt1 ((float, float)) – Right back point of box in robot space (x, y)

  • pt2 ((float, float)) – Left front point of box in robot space (x, y)

  • color ((byte, byte, byte)) – color of box on canvas, defaults to (255, 0, 0)

draw_cluster_points_laser(points, cluster_labels)[source]

Draws a list of clustered points to canvas. Six different colors are available to color the clusters differently.

Parameters
  • points (list of (float, float)) – list of points (defined in laser space)

  • cluster_labels (list of int) – list of cluster labels, the list has to have the same length as points

draw_cross_world(point, color=(128, 128, 0), size=2)[source]
draw_crosses_world(lst_points, color=(255, 255, 255), size=2)[source]

Draws a list of crosses to canvas.

Parameters
  • lst_points (list of (float, float)) – list of points (defined in world space)

  • color ((byte, byte, byte)) – color of dot on canvas, defaults to (255, 255, 255)

  • size – size of crosses, defaults to 2

Type

int

draw_ellipse_world(point, covariance, sigma, color=(0, 128, 128))[source]
draw_line_world(slope, offset, color=(0, 0, 255))[source]
draw_origin_world()[source]
draw_point_laser(point, color=(255, 255, 255))[source]

Draws a dot on canvas. The dot is defined by one point in laser space.

Parameters
  • point ((float, float)) – point in laser space (x, y)

  • color ((byte, byte, byte)) – color of dot on canvas, defaults to (255, 255, 255)

draw_point_world(point, color=(255, 255, 255))[source]

Draws a dot on canvas. The dot is defined by one point in world space.

Parameters
  • point ((float, float)) – point in world space (x, y)

  • color ((byte, byte, byte)) – color of dot on canvas, defaults to (255, 255, 255)

draw_points_laser(lst_points, color=(255, 255, 255))[source]

Draws a list of points to canvas.

Parameters
  • lst_points (list of (float, float)) – list of points (defined in laser space)

  • color ((byte, byte, byte)) – color of dot on canvas, defaults to (255, 255, 255)

draw_points_world(lst_points, color=(255, 255, 255))[source]

Draws a list of points to canvas. points are defined in world space

Parameters
  • lst_points (list of (float, float)) – list of points (defined in world space)

  • color ((byte, byte, byte)) – color of dot on canvas, defaults to (255, 255, 255)

draw_robot(color=(0, 255, 0))[source]

Draws the robot on the canvas as rectangle with the given color.

Parameters

color ((byte, byte, byte)) – color of robot on canvas, defaults to (0, 255, 0)

send_image()[source]

Sends out the canvas via the ROS publisher.

set_current_pose(current_pose)[source]

Setter for robots current pose

Parameters

current_pose ((float, float, float)) – current pose of robot in world space (x, y, yaw)

to_visu_coord(point)[source]

Converts a point in world coordinates to pixel coordinates on canvas.

Parameters

point (number[2]) – point to be converted to pixel coord

Returns

pixel coordinates on canvas

Return type

(int, int)