LaserScanner

class mobrob_behcon.connectors.laserscanner.LaserScanner(ros_topic, visu)[source]

The class LaserScanner

Represents a connector to the laserscanner topics of the robot. Provides a function to get the latest laserscan from the laserscanner on the robot.

Methods

__init__(ros_topic, visu)

constructor

calc_dist(x, y)

Calculate distance from origin to given point

callback(msg)

callback function for topics of type sensor_msgs/LaserScan

check_box(x1, y1, x2, y2)

Check if some obstacle is in given box.

draw_laserpoints()

Draw all laser scanpoints to visualisation

extract_points(ranges)

Extract points from a list of distances

filter_points(list, x_min, x_max, y_min, y_max)

Filter given list of points (x, y) with the given bounderies

get_current_time()

Get current time in milliseconds

get_lst_scan_points()

Get current laserscan as a list of points

get_x(radius, angle)

Get x-coordinate of given point in polar coordinates

get_y(radius, angle)

Get y-coordinate of given point in polar coordinates

Details

__init__(ros_topic, visu)[source]

constructor

Parameters

ros_topic (string) – topic of the LaserScan data

static calc_dist(x, y)[source]

Calculate distance from origin to given point

Parameters
  • x (float) – x-coordinate [m]

  • y (float) – y-coordinate [m]

Returns

distance [m]

Return type

float

callback(msg)[source]

callback function for topics of type sensor_msgs/LaserScan

Parameters

msg – receiving message

check_box(x1, y1, x2, y2)[source]

Check if some obstacle is in given box. Returns distance.

Parameters
  • x1 (float) – x-coordinate of first corner of box

  • y1 (float) – y-coordinate of first corner of box

  • x2 (float) – x-coordinate of second corner of box

  • y2 (float) – y-coordinate of second corner of box

Returns

distance to nearest point in this box, if no obstacle in box returns 0

Return type

float

draw_laserpoints()[source]

Draw all laser scanpoints to visualisation

static extract_points(ranges)[source]

Extract points from a list of distances

Parameters

ranges (list(float)) – list of distances (length=360)

Returns

list of points (x, y)

Return type

list((float, float))

static filter_points(list, x_min, x_max, y_min, y_max)[source]

Filter given list of points (x, y) with the given bounderies

Parameters
  • list (list((float, float))) – list of points (x, y)

  • x_min (float) – lower bound x

  • x_max (float) – upper bound x

  • y_min (float) – lower bound y

  • y_max (float) – upper bound y

Returns

filtered list of points (x, y)

Return type

list((float, float))

static get_current_time()[source]

Get current time in milliseconds

Returns

time in milliseconds

get_lst_scan_points()[source]

Get current laserscan as a list of points

Returns

laserscan as a list of points (x,y)

Return type

list((float, float))

static get_x(radius, angle)[source]

Get x-coordinate of given point in polar coordinates

Parameters
  • radius (float) – radius [m]

  • angle (float) – angle [deg]

Returns

x-coordinate [m]

Return type

float

static get_y(radius, angle)[source]

Get y-coordinate of given point in polar coordinates

Parameters
  • radius (float) – radius [m]

  • angle (float) – angle [deg]

Returns

y-coordinate [m]

Return type

float