# Hardware Drivers of OREO
The following tutorials are all tested on Ubuntu 20.04.6 LTS.
## Velodyne VLP-16 3D LiDAR
### Connect your LiDAR
Connect the LiDAR to an Ethernet port and disable the WiFi connection on OREO.
* Go to **Network Connections** and click the "+" button next to **enp2s0**. (which is the 1000 Mbps one)
* Change the connection name (vlp16) then choose the IPv4 setting tab and change the "Method" field to **Manual**.
* Then key in the addresses as below:
* Address: `192.168.12.200`
:::success
"200" can be any number in a range between 1 and 254, **except 201**
:::
* Netmask: `255.255.255.0`
* Gateway: `0.0.0.0`
* Finally check the connection in `192.168.12.201`. You can set the FOV and motor angular velocity here.

OREO setting will set Ethernet as first priority to Internet.
Set Wi-Fi as first priority so that you can connect to LiDAR and Internet at the same time.
:::warning
Check the **Use this connection only for resources on its network** option in **Network** to avoid changes to the settings when you restart the robot.
:::
Referenceļ¼ http://wiki.ros.org/velodyne/Tutorials/Getting%20Started%20with%20the%20Velodyne%20VLP16
### Start to install driver!
#### Install ROS dependencies
```shell!=
sudo apt-get install ros-VERSION-velodyne
```
In our case, `VERSION="noetic"`
#### Go to catkin workspace
```shell!=
cd ~/catkin_ws/src
```
#### Clone the repo and build it
Reference: https://github.com/ros-drivers/velodyne.git
```shell!=
git clone https://github.com/ros-drivers/velodyne.git
rosdep install --from-paths src --ignore-src --rosdistro YOURDISTRO -y
cd ..
catkin_make
```
It is now ready to run!
### View the LiDAR data using RViz
```shell!=
source devel/setup.bash
roslaunch velodyne_pointcloud VLP16_points.launch
```
Open **another terminal tab**, check the nodes are running properly.
```shell!=
rosnode list
rostopic echo /velodyne_points
```
After that, launch **RViz**, with the `velodyne` as a fixed frame.
```shell!=
rosrun rviz rviz -f velodyne
```
1. In the **displays** panel, click **Add**, then select `PointCloud2`, then press **OK**.
2. In the **Topic** field of the new `PointCloud2` tab, enter `/velodyne_points`.
3. Have fun!

<br>
## SICK LMS100 (2D Laser)
### Connect your 2D Laser
* Go to **Network Connections** and click the "+" button next to **enp0s31f6**. (which is the 100 Mbps one)
* Change the connection name (sick) then choose the IPv4 setting tab and change the "Method" field to **Manual**.
* Then key in the addresses as below:
* Address: `192.168.11.100`
* Netmask: `255.255.255.0`
* Gateway: `0.0.0.0`
Make sure the Wi-Fi is set as first priority.
:::warning
Check the **Use this connection only for resources on its network** option in **Network** to avoid changes to the settings when you restart the robot.
:::
### Configure the IP address of sensor device
* Prepare a Windows PC and download [SOPAS ET](https://www.sick.com/hk/zf/catalog/digital-services-and-solutions/software/sopas-engineering-tool-32-bit/p/p367244?tab=downloads).
* Connect the ethernet cable of SICK to the PC.
* Launch SOPAS, then click **Search devices**. Now you will see the information of your SICK device listed on the panel.
* Change the **Address** to `192.168.11.71`.
> **This step is very important and make sure that the Laser and host PC have different IP addresses e.g. 192.168.11.100 for the PC and 192.168.11.71 for the scanner.**
* Save and exit. Plug the cable back to the computer of OREO.
* To test the settings, open a terminal and enter the command `nc -z -v -w5 $SCANNERIPADDRESS 2112`. This command is used to check if a TCP connection to the scanner can be established. Please refer [**test connection under Linux**](https://github.com/SICKAG/sick_scan/blob/master/doc/ipconfig/ipconfig.md) for more details.
### Installing driver
Reference: https://github.com/SICKAG/sick_scan_xd
#### Go to catkin workspace
```shell!=
cd ~/catkin_ws/src
```
#### Start building!
```shell!=
git clone https://github.com/SICKAG/sick_scan_xd
cd ..
catkin_make
source devel/setup.bash
```
#### Launch it!
* First navigate to the launch file `sick_lms_1xx.launch`. Then set the argument `hostname` as `192.168.11.71` (your sensor's IP).
* Launch the launch file which is corresponding to your device's model name.
```shell!=
roslaunch sick_scan_xd sick_lms_1xx.launch
```
* You can check the scanning result by using `rostopic echo /cloud` or `rviz` (with fixed frame **cloud**).
<br>
## ZED2 (RGBD camera)
Reference: https://github.com/stereolabs/zed-ros-wrapper
### Prerequisites
* Ubuntu 20.04
* ZED SDK >= 4.0.6 and its dependency CUDA (we installed `cuda-11.8` for OREO)
* ROS Noetic
### Install ZED SDK
* Go to https://www.stereolabs.com/developers/ to download the latest version of the ZED SDK.
* Install it.
### Install the ZED ROS wrapper
Open a terminal, clone the repository, update the dependencies and build the packages:
```shell!=
cd ~/catkin_ws/src
git clone --recursive https://github.com/stereolabs/zed-ros-wrapper.git
cd ../
rosdep install --from-paths src --ignore-src -r -y
catkin_make -DCMAKE_BUILD_TYPE=Release
source ./devel/setup.bash
```
### Run the ZED wrapper
```shell!=
roslaunch zed_wrapper zed2.launch
```
You can also run RViz to verify whether the installation is completed.
<br>
## Hokuyo URG-04LX
### Reference
https://github.com/ros-drivers/urg_node
https://github.com/ros-drivers/urg_c
https://github.com/ros-perception/laser_proc
### Installation
* Install `urg_node`, `urg_c`, and `laser_proc` to ROS Noetic.
```shell!=
sudo apt-get install ros-noetic-urg-node
sudo apt-get install ros-noetic-urg-c
sudo apt-get install ros-noetic-laser-proc
```
* Add a new directory named `hokuyo` in the workspace.
```shell!=
cd ~/catkin_ws/src
mkdir hokuyo
cd hokuyo
```
* Clone the repositories to the folder and build. You just need to build `urg_node` package only. (notice the branch you cloned)
```shell!=
git clone -b "melodic-devel" --single-branch https://github.com/ros-drivers/urg_node
git clone https://github.com/ros-drivers/urg_c
git clone https://github.com/ros-perception/laser_proc
rosdep install --from-paths ~/catkin_ws/src --ignore-src
cd ~/catkin_ws
catkin_make -DCATKIN_WHITELIST_PACKAGES="urg_node"
```
### Launch Hokuyo
#### Prerequisite
Before launching the device, we need to get the read/write permission of the USB connection device `/dev/ttyACM0` or `/dev/ttyACM1`. Using the `sudo chmod 777 /dev/ttyACM*` command to grant read and write permissions to all users on ``/dev/ttyACM*`` is more dangerous and not secure. Therefore, we have adopted an alternative approach. By using the `ls -l /dev/tty*` command, we can determine that only the **root** user and the `dialout` group have read and write permissions. Consequently, we have chosen to add the host PC to the dialout group, which allows us to obtain read and write permissions.
```shell!=
cd ~
sudo usermod -a -G dialout <username> # append the host <username> to the group `dialout`
```
#### Launch it!
* Before start launching, make sure that Hokuyo is connecting with either `/dev/ttyACM0` or `dev/ttyACM1`. (use `udevadm info /dev/ttyACM*` to check)
* Open the launch file `urg_lidar.launch` and change the value of the parameter `serial_port` based on the result above.

* Finally, we can start to launch Hokuyo!
```shell!=
cd catkin_ws
source devel/setup.bash
roslaunch urg_node urg_lidar.launch
```
You may visualize the result by using `rviz`.
```shell!=
rosrun rviz rviz -f laser
```
<br>
## Intel Realsense D435i (RGBD camera)
Reference: https://github.com/IntelRealSense/realsense-ros
* Go to the official website above.
* Change the branch to `ros1-legacy` which is compatible with Ubuntu 20.04.
* Follow the instructions in **Method 1: The ROS distribution**.
* Follow the usage instruction **Start the camera node** to check whether the installation is completed.