UR-50 Long Range LiDAR

Magni lidar connection

Schematic

Range 50 m
Cabling Ethernet + AMP Power Plug
Based on LeiShen N301
Input power voltage 12V
Input power consumption 6 W (500mA@12V)
Scan frequency 20 Hz
Min detection distance 0.05m
Max detection distance 50m
Scan angle 360 degree
Ranging method TOF flight time ranging
SKU LRL000001

When changing out sensors makes sure to disconnect the RED battery cable from the batteries and wait 2 minutes so high voltage and current are not linked with the main board!

This tutorial is intended for magni_robot branch: noetic-devel and ROS Noetic.

Installation

Connect the lidar lan cable into Raspberry Pi lan port and the power supply connector into the right molex connector on the MCB board:

Magni lidar connection

Using 4xM3 screws, the lidar can be mounted on the top plate that comes with Magni robot

Now the batteries can be reconnected and the robot powered on.

If you’re using a shell + tower setup, see the shell assembly guide on how to mount the lidar onto it.

Default location

The default location of the lidar is on the top plate looking into the forward direction (lidar connector is turned backward). Top plate of newer robots comes ready with holes for lidar mounting. But some of the older versions don’t have those holes. In that case please either contact Ubiquity Robotics to supply you with a new top plate OR use double sided tape to mount the lidar. If you chose to mount the lidar with the double sided tape please make sure its 1.) turned exactly forward - a slight offset in angle can result in inaccurate localization and 2.) its center is EXACTLY the position shown on the picture.

Magni Laser Rviz

On the picture red, green, blue correspond to x, y and z axis. Lidar is the component that says ‘laser’ on the image (lidars are sometimes also called lasers)

Advanced: Changing LIDAR internal IP settings

Warning: IPs are changed from their defaults, it is highly likely nothing will work out of the box with Ubiquity Robotics products.

If buying a lidar from Ubiquity Robotics, the lidar will come pre-set with the IPs that were used in these tutorials:

  • LIDAR IP: 192.168.42.222
  • IP to which lidar is connected (workstation IP): 192.168.42.125

If you want to change those lidar-internal IPs here is a video about how to do that.

Additionally to whats shown on the video, make sure:

  1. First make sure you have WinPcap installed (sourced here or download from the internet)
  2. Follow the steps shown on the video to change the LIDAR IP, but a couple of notes:
    • in the video PC IP is changed from 192.168.1.125 to 192.168.42.125. This was done because often external network is also on the subnet 192.168.1.xxx and this creates problems with the internet connection.
    • in the video the IP is changed to 192.168.42.125 -> this is arbitrary and can be any IP

Setup to work with Raspberry Pi

Network

The lidar should come pre-configured with static IP: 192.168.42.222 and only answering to requests coming from IP 192.168.42.125, so we need to configure that on the RPI.

sudo nano /etc/systemd/network/10-eth-dhcp.network

and replace everything in there with

[Match]
Name=eth*

Address=192.168.42.125/24
[Network]

and then sudo reboot or sudo systemctl restart systemd-networkd. After that the IP on eth interface should always be set to 192.168.42.125 when any device is plugged into ethernet port. You can check that with

ubuntu@pi-focal ~$ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.42.125  netmask 255.255.255.0  broadcast 192.168.42.255
        inet6 fe80::e65f:1ff:fe33:ef3f  prefixlen 64  scopeid 0x20<link>
        ether e4:5f:01:33:ef:3f  txqueuelen 1000  (Ethernet)
        RX packets 243450  bytes 302746896 (302.7 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5618  bytes 2593522 (2.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Compiling

cd ~/catkin_ws/src
git clone https://github.com/UbiquityRobotics/ls_lidar_driver
cd ~/catkin_ws/
rosdep install --from-paths src --ignore-src -r -y
catkin_make

Running

cd ~/catkin_ws/
source devel/setup.bash
roslaunch lslidar_n301_decoder lslidar_n301_config.launch device_IP:=192.168.42.222

Default lidar extrinsics

The system is setup so that lidar extrinsics can be set in two places with following priorities:

1st priority in ~/.ros/extrinsics/lidar_extrinsics_<POSITION>.yaml

2nd priority in package magni_description/extrinsics/lidar_extrinsics_<POSITION>.yaml

Where <POSITION> is taken from ~/.ros/ubiquity/robot.yaml, parameter lidar_position.

Example:

This means that if in ~/.ros/ubiquity/robot.yaml the parameter lidar_position is set to top_plate, like it is by default (see default robot.yaml settings), the system will first search for ~/.ros/extrinsics/lidar_extrinsics_top_plate.yaml. If that does not exists it will search for magni_description/extrinsics/lidar_extrinsics_top_plate.yaml. If none of those can be found the lidar extrinsics will not be loaded.

The difference between the two locations is that inside ~/.ros/extrinsics/ the extrinsics files will be robot-specific and will not be overwritten by git pulls or automatic updates - its meant for users to store custom extrinsics files. Where as magni_description/extrinsics/ location will be overwriten with both git pulls and updates - its meant as a storage of widely used default extrinsics.

Example: Adding a custom lidar location

You can mount the lidar in a custom location on the robot, but then you need to indicate the extrinsics (x, y, z, roll, pitch, yaw) of the custom location in robots configuration files. That can be easily done by:

1.) adding an additional extrinsics configuration into ~/.ros/extrinsics/lidar_extrinsics_<POSITION>.yaml, where <POSITION> is an arbitrary name for the new configuration. Lets say a new lidar location with name “backward” must be added - lidar turned backwards. In this case we would:

nano ~/.ros/extrinsics/lidar_extrinsics_backward.yaml

and into it insert the coordinates of the lidar turned by 180 degrees in yaw:

### This file must be formated in the following way
#
### x: 0.0
### y: 0.0
### z: 0.0
### roll: 0.0
### pitch: 0.0
### yaw: 0.0
#
### Otherwise you might experience "No such key" errors when running robot description urdfs

x: 0.2
y: 0.0
z: 0.0
roll: 0.0
pitch: 0.0
yaw: 3.14 #pi

2.) now the newly created extrinsic configuration lidar_extrinsics_backward.yaml must be set to be used the next time rpi boots:

sudo nano /etc/ubiquity/robot.yaml

where the lidar_position must be set to “backward”

lidar_position: 'backward' ### to disable insert "None"

Now raspberry pi can either be restarted OR the systemctl reloaded with:

sudo systemctl restart magni-base.service

The lidar is now set at a custom location which can be seen in Rviz. To see all available extrinsics files both for camera and lidar please check directories ~/.ros/extrinsics/ (user specified custom extrinsics) and ~/catkin_ws/src/magni_robot/magni_description/extrinsics/ (system default extrinsics - will be overridden with every git update)