2D laser scanners

sudo apt-get install ros-indigo-urg-node

Configure your network:

sudo ifconfig eth0 192.168.0.2

or

rosrun urg_node urg_node _ip_address:="192.168.0.10"

To visualize in rviz:

rosrun rviz rviz

Set the Fixed Frame (top left of rviz window) to /laser

Add a LaserScan display, and set the topic to /scan/LaserScan.

Visualize the laser:

The following code show how to visualize the shape of the laser:

#!/usr/bin/env python
import rospy

import cv2
import numpy as np
import math

from sensor_msgs.msg import LaserScan

def callback(data):
    frame = np.zeros((500, 500,3), np.uint8)
    angle = data.angle_min
    for r in data.ranges:
        x = math.trunc( (r * 30)*math.cos(angle + (-90*3.1416/180)) )
        y = math.trunc( (r * 30)*math.sin(angle + (-90*3.1416/180)) )
        cv2.line(frame,(250, 250),(x+250,y+250),(255,0,0),2)
        angle= angle + data.angle_increment

    cv2.circle(frame, (250, 250), 2, (255, 255, 0))
    cv2.imshow('frame',frame)
    cv2.waitKey(1)

def laser_listener():
    rospy.init_node('laser_listener', anonymous=True)
    rospy.Subscriber("/scan", LaserScan,callback)
    rospy.spin()

if __name__ == '__main__':
    laser_listener()

sudo apt-get install ros-indigo-sick-tim

sudo apt-get install libusb-1.0-dev
mkdir -p ~/sick_ros_ws/src
cd ~/sick_ros_ws/src
catkin_init_workspace
git clone https://github.com/uos/sick_tim.git
cd ..
catkin_make_isolated
source ~/devel_isolated/setup.bash

To give all users write access to the SICK TiM device, run the following commands:

touch 81-sick-tim3xx.rules
vi 81-sick-tim3xx.rules

Insert this line into 81-sick-tim3xx.rules:

SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="19a2", ATTR{idProduct}=="5001", GROUP="plugdev"

Copy the rule into your system:

sudo cp 81-sick-tim3xx.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules

Now unplug your USB cable and plug it in again. This will allow you to communicate with the laser scanner without running the node as root.

By default the node will try to use the USB connection. To use the ethernet connection instead (for those scanners that have one), you have to set the parameter "hostname" to the scanner hostname or IP (see commented out part in the respective sick_tim/launch/sick*.launch files).

The scanner IP can be changed using the SICK SOPAS-ET configuration software.

roslaunch sick_tim sick_tim571_2050001.launch

<?xml version="1.0"?>
<launch>
    <param name="robot_description" command="$(find xacro)/xacro.py '$(find sick_tim)/urdf/example.urdf.xacro'" />
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />

    <node name="sick_tim571_2050101" pkg="sick_tim" type="sick_tim551_2050001" respawn="false" output="screen">
        <param name="range_max" type="double" value="30.0" />

        <param name="hostname" type="string" value="192.168.0.1" />
        <param name="port" type="string" value="2112" />
        <param name="timelimit" type="int" value="5" />
  </node>
</launch>

<?xml version="1.0"?>
<launch>
  <param name="robot_description" command="$(find xacro)/xacro.py '$(find sick_tim)/urdf/example.urdf.xacro'" />
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />

  <node name="sick_tim571_2050101" pkg="sick_tim" type="sick_tim551_2050001" respawn="false" output="screen">
    <param name="range_max" type="double" value="25.0" />
  </node>
</launch>

The network can be configured with a command:

sudo ifconfig eth0 192.168.0.2

Also can be configured via graphical interface:

To visualize in rviz:

rosrun rviz rviz

Set the Fixed Frame (top left of rviz window) to /laser_mount_link.

Add a LaserScan display, and set the topic to /scan/LaserScan.

Visualize the laser:

The following code show how to visualize the shape of the laser:

#!/usr/bin/env python
import rospy

import cv2
import numpy as np
import math

from sensor_msgs.msg import LaserScan

def callback(data):
    frame = np.zeros((500, 500,3), np.uint8)
    angle = data.angle_min
    for r in data.ranges:
        x = math.trunc( (r * 30)*math.cos(angle + (-90*3.1416/180)) )
        y = math.trunc( (r * 30)*math.sin(angle + (-90*3.1416/180)) )
        cv2.line(frame,(250, 250),(x+250,y+250),(255,0,0),2)
        angle= angle + data.angle_increment

    cv2.circle(frame, (250, 250), 2, (255, 255, 0))
    cv2.imshow('frame',frame)
    cv2.waitKey(1)

def laser_listener():
    rospy.init_node('laser_listener', anonymous=True)
    rospy.Subscriber("/scan", LaserScan,callback)
    rospy.spin()

if __name__ == '__main__':
    laser_listener()

Feature Description
Electrical connection 1 x “Ethernet” connection, 4-pin M12 female connector
1 x connection “Power/Synchronization output” 5-pin, M12 male connector
1 x Micro USB female connector, type B
Operating voltage 9 V DC ... 28 V DC
Power consumption 3 W
Housing color Gray (RAL 7032)
Enclosure rating IP 67 (EN 60529/A1:2000-02)
Protection class III (EN 60950-1/A11 (2009-03))
Weight 250 g, without connecting cables
Dimensions (L x W x H) 60 mm x 60 mm x 86 mm

Feature Description
Light source Infrared (850 nm)
Laser class 1, eye-safe (EN 60825-1 (2007-10))
Aperture angle 270°
Scanning frequency 15 Hz
Angular resolution 0.33°
Operating range 0.05 m ... 25 m
Max. range with 10 % reflectivity 8 m

Feature Description
Ethernet IP: 192.168.0.1
USB micro USB