How to connect Neato XV-11 Lidar to Raspberry Pi 2 or 3 with ROS


Laser 360 range sensor from vacuum cleaner Neato XV-11 is one of the most popular and cheapest way to get lidar for robotics experiments.
Sensor has two connectors - first is an ordinary serial port, another is power for motor. Despite on XV-11 Lidar’s price, it provides pretty good measurement data with transmission rate up to 5Hz. Of course there are drivers for ROS, which consume raw sensor data and convert it LaserScan format.
LaserScan is an array of range sensor data withing some angle range. Neato Lidar provides range data in 360 degrees. LaserScan information can be used in robotics for SLAM - map building, obstacle avoidance, etc…


Video transcript:

1) Parts we need for connection Neato lidar to RPi
    - Neato XV-11 range sensor itself;
    - We also need any 16 Mhz arduino board, diode and N-MOSFET to for PWM output for motor;
    - 3D-printed frame from Thingiverse as an option

2) Wiring is rather simple: +5V DC for logic and maximum 3V DC for motor. But note that some old revisions were powered by 3.3V, so please check what version do you have!
Remember that the motor needs 3.0V instead of 3.3V or it will spin too fast. 

3) We will only read from lidar, so there is no need to connect RX pin to Arduino

4) Note: diode is soldered directly to lidar's motor

5) roscore and lidar driver node will be launched on RPi. Laptop is used as a slave just to run rviz

6) BTW, it is possible to connect lidar directly to RPi, but using arduino as a proxy with firmware from getSurreal will make lidar more configurable

7) Raw data mode will show all data read from lidar without any changes

8) But there are also commands that can help you configure motor speed, controller parameters, dead zones, etc.

9) I assume that you have RPi with ROS installed. If no - check my previous videos how to do it!

10) Now let's install needed driver. You can get it from repository or github
    - Install ROS driver for XV-11 Lidar from repository: 
    $ sudo apt install ros-kinetic-xv-11-laser-driver
    - Install driver from GitHub:
    $ mkdir -p xv-11_ws/src; cd xv-11_ws/src
    $ git clone https://github.com/rohbotics/xv_11_laser_driver.git
    $ cd ..; catkin_make


11) Neato_laser_publisher node reads raw data from port, and publishes 2 topics Laserscan itself and RPM

12) Let's check if lidar is connected:
    $ lsusb                    
    $ ls -la /dev/ttyACM*


13) For distributed ROS network we need to set environment variables: ROS_IP and ROS_MASTER:
- On RPi
    $ export ROS_IP="{RPi_IP}"
    $ export ROS_MASTER_URI="{RPi_IP}"
- On PC:
    $ export ROS_IP="{PC_IP}"
    $ export ROS_MASTER_URI="{RPi_IP}"

Where PC_IP = IP address of laptop, RPi_IP = IP address of Raspberry Pi

14) Run roscore in background process:
     $ roscore&

15) Now everything is ready to run neato_laser_publisher node:
    $ rosrun xv_11_laser_driver neato_laser_publisher _port:=/dev/ttyACM0 _firmware_version:=2
Where:
xv_11_laser_driver - package
neato_laser_publisher - node name
Parameters:
_port:=/dev/ttyACM0 - hardware port with lidar
_firmware_version:=2 - lidar firmware version
  vast majority have version 2

16) To see LaserScan data we can use Rviz. Default fixed frame - "neato_laser":
    $ rviz

17) Maximum stable transfer rate is 5Hz. It means 5 laserscan messages per second

18) Effective distance is from 10 cm to 4-5 meters. For the distance more than 5 meters data is too noisy


Links:

2 комментария:

  1. Ответы
    1. Yes, but you need to modify wiring a little bit. You'll understand what to change when see connection difference between P and N MOSFETs

      Удалить