Package sick_ldmrs :: Module dataproc :: Class ProcessLDMRSData
[frames] | no frames]

Class ProcessLDMRSData

source code


Class for processing and packaging Sick LD-MRS Laser Scan data messages into ROS messages.
Converts raw scan data into ROS PointCloud2 and LaserScan messages and publishes them on request.
The primary method you need to call is process_msg. This method processes the scan data
    and publishes LaserScan and/or PointCloud2 messages of the (transformed) data.
You will also need to call set_timestamp_delta() to set the difference between the
current time and the LD-MRS on-board time (which you can extract from the message header)

Instance Methods
 
__init__(self, topics, params)
Constructor
source code
 
compute_tick_freq(self)
Compute the tick frequency from the start/end angles and times.
source code
 
make_point_cloud(self)
Construct a point cloud from previously unpacked data (see unpack_data()) The finished point cloud is stored as the instance variable 'point_cloud' Note you must call unpack_data before invoking this method
source code
 
make_scans(self)
Generate laser scan messages from previously unpacked data the ROS parameter value of 'use_first_echo' in the ROS parameter server determines if first or last echo is used
source code
 
num_subscribers(self)
Get the number of subscribers for each ROS topic defined in self.topics
source code
 
process_msg(self, msg, recv_time)
Process an incoming data message.
source code
 
publish_point_cloud(self)
Publish the finished point cloud to the ROS network topic is /<node_name>/cloud
source code
 
publish_scans(self)
Publish scan topics on the ROS network.
source code
 
set_timestamp_delta(self, time_delta)
Set the time delta to apply to the LD-MRS timestamp to bring it up to current ROS time.
source code
 
smooth_timestamp(self, recv_time)
Smooth the timestamp to track the expected scan rate.
source code
 
unpack_data(self, msg)
Unpack the data from an LD-MRS scan data message into instance attributes to be picked up by make_point_cloud and/or make_scan.
source code
Class Variables
  elev_angles = array([-0.02094395, -0.00698132, 0.00698132, 0...
  header_format = '<HHHQQHhhHhhhhhhH'
  header_keys = ['ScanNumber', 'ScannerStatus', 'SyncPhaseOffset...
  header_struct = <Struct object at 0x192d848>
  num_header_bytes = 44
  num_point_bytes = 10
  v_cos_lut = array([ 0.99978068, 0.99997563, 0.99997563, 0.9...
  v_sin_lut = array([-0.02094242, -0.00698126, 0.00698126, 0.0...
Method Details

__init__(self, topics, params)
(Constructor)

source code 

Constructor

Parameters:
  • topics (dict {topic_name:publisher_handle}) - dictionary mapping topic names to publisher handles valid topic names are {"cloud", "scan0", "scan1", "scan2", "scan3"}
  • params (dict {ros_parameter_string:value}) - dictionary mapping parameter names to values. Where applicable, the parameters must be in device units (e.g. ticks)

compute_tick_freq(self)

source code 

Compute the tick frequency from the start/end angles and times. This is typically within 1% of the nominal values. Note: we are using the device supplied tick resolution of 1/32nd degree

Returns:
tickfrequency - a floating point number (ticks per second)

process_msg(self, msg, recv_time)

source code 

Process an incoming data message. Convert to (and publish) PointCloud2 and LaserScan ROS messages depending on whether the associated topics ('cloud', 'scan0', 'scan1', 'scan2', 'scan3') resp. are subscribed.

Parameters:
  • msg (read-only byte buffer (e.g. a python string)) - the scan data message from the LD-MRS to be processed

publish_scans(self)

source code 
Publish scan topics on the ROS network.
Publishes four topics (one for each scan plane of the LD-MRS):
    /<node_name>/scan0    -- the lowest scan plane
    /<node_name>/scan1
    /<node_name>/scan2
    /<node_name>/scan3    -- the highest scan plane

set_timestamp_delta(self, time_delta)

source code 

Set the time delta to apply to the LD-MRS timestamp to bring it up to current ROS time.

Parameters:
  • time_delta (a rostime.Duration object) - the time delta to be applied to the timestamps from the LD-MRS

smooth_timestamp(self, recv_time)

source code 

Smooth the timestamp to track the expected scan rate. Parameter time_smoothing_factor controls Small errors between rostime and smoothed time are corrected by applying a correction weighted by the time_smoothong_gain Large errors above the time_error_threshold are corrected to recv_time by a step adjustment

Parameters:
  • recv_time - ros timestamp when the message was recieved
  • ldmrs_time (rostime.Time object)

unpack_data(self, msg)

source code 

Unpack the data from an LD-MRS scan data message into instance attributes to be picked up by make_point_cloud and/or make_scan.

Parameters:
  • msg (read-only byte buffer (e.g. a python string)) - a binary string in little-endian format encoding the message

Class Variable Details

elev_angles

Value:
array([-0.02094395, -0.00698132,  0.00698132,  0.02094395])

header_keys

Value:
['ScanNumber',
 'ScannerStatus',
 'SyncPhaseOffset',
 'ScanStartTimeNTP',
 'ScanEndTimeNTP',
 'AngleTicksPerRot',
 'StartAngle',
 'EndAngle',
...

v_cos_lut

Value:
array([ 0.99978068,  0.99997563,  0.99997563,  0.99978068])

v_sin_lut

Value:
array([-0.02094242, -0.00698126,  0.00698126,  0.02094242])