# Kudan Integration

{% hint style="info" %}
[**Kudan Inc**](https://www.kudan.io/) is a Japan-headquartered company focusing on artificial perception computer software by providing artificial perception solutions, such as localization and mapping software.

[**Kudan**](https://www.kudan.io/) offers commercial-grade localization and mapping software based on SLAM technology (Simultaneous localization and mapping). This technology enables machines and devices to understand where they are, how they are moving, and the structure of their environment.

For more information, please refer to [Kudan’s website](https://www.kudan.io/), or if you want to use a Kudan as your SLAM solution for your 3D lidar, you can contact <sales@movel.ai>.
{% endhint %}

{% embed url="<https://www.kudan.io/>" %}

## How to Integration the Kudan Packages into Seirios RNS

First, you have to download the **Kudan ROS Packages**, \
If you haven't installed the Seirios RNS yet, you can download the kudan-movel easy deploy package using this [link](https://drive.google.com/drive/folders/1SKigdvr2LnYKPDsgW36oiPAUROFuCQJc?usp=share_link) (only for x86\_64 architecture).\
But if you already installed the Seirios RNS yet, you can contact <sales@movel.ai> for the link to download the Kudan Packages.\
\
Then please make sure your seirios-ros image version is at least `2.48.9` or newer.\
You can check it by executing this command:\
`docker ps | grep seirios-ros`\
And see the version on this line:

```
registry.gitlab.com/movelai/client_deploy/seirios_ros/master_x86:<version>
```

If your version is older than `2.48.9`, please contact <sales@movel.ai> for updating the version.

### 1. Kudan Setup

1. Copy the kdlidar\_ros package into the `~/catkin_ws/movel_ai/` folder
2. Change the permission of kdlidar\_ros, so it can be executed inside the docker\
   `chmod -R +x ~/catkin_ws/movel_ai/kdlidar_ros/`
3. Configure tf/transform parameters in these launch files:
   1. `~/movel_ws/kdlidar_ros/install/share/kdlidar_ros/launch/kdlidar_ros_pcl_localise.launch` , \
      Change the `platform_to_lidar0_rot` and `platform_to_lidar0_trans` based on your tf from lidar link to base\_link.

      ```
      <rosparam param="platform_to_lidar0_rot">
                  [1, 0,  0,
                  0,  1,  0,
                  0, 0,  1]
      </rosparam>
      <rosparam param="platform_to_lidar0_tran">
                  [0.032, 0.000, -0.178]
                  <!-- [0, 0, 1.73] -->
      </rosparam>
      ```
   2. `~/movel_ws/kdlidar_ros/install/share/kdlidar_ros/launch/kdlidar_ros_pcl_mapping.launch`, \
      Change the `platform_to_lidar0_rot` and `platform_to_lidar0_trans` based on your tf from lidar link to base\_link.

      ```
      <rosparam param="platform_to_lidar0_rot">
                  [1, 0,  0,
                  0,  1,  0,
                  0, 0,  1]
      </rosparam>
      <rosparam param="platform_to_lidar0_tran">
                  [0.032, 0.000, -0.178]
                  <!-- [0, 0, 1.73] -->
      </rosparam>
      ```

### 2. Docker Setup

1. Create the `ros_entrypoint.sh` in the `~/catkin_ws/movel_ai/` folder.

   ```
   #!/bin/bash

   # setup ros environment
   source "/opt/ros/$ROS_DISTRO/setup.bash"
   source /home/movel/kdlidar_ros/install/setup.bash
   exec "$@"
   ```

   \
   Also, change the permission of the ros\_entry\_point.sh by executing this command:\
   `sudo chmod +x ~/catkin_ws/movel_ai/ros_entrypoint.sh`
2. Edit your `docker-compose.yaml` file in the `~/catkin_ws/movel_ai/` folder.\
   Under the seirios-ros volumes, add the following line:

   ```
   seirios-ros:
       ...
       volumes:
           ...
           -/home/$USER/catkin_ws/movel_ai/kdlidar_ros:/home/movel/kdlidar_ros:rw
           -/home/$USER/catkin_ws/movel_ai/ros_entrypoint.sh:/ros_entrypoint.sh:rw
           ...
   ```
3. Add the following variables under the seirios-backend and seirios-frontend environment:

   ```
   seirios-frontend:
       ...
       environment:
           THREE_D_MAPPING: "true"
           SHOW_3D_VIEW: "true"
       ...
   seirios-backend:
       ...
       environment:
           SHOW_3D_VIEW: "true"
       ...
   ```

### 3. task\_supervisor Config Setup

Edit the `task_supervisor.yaml` (at `~/catkin_ws/movel_ai/config/task_supervisor/config/task_supervisor.yaml`)

1. Add `kudan_localization_handler` to the **plugins** section with the following lines and comment if there's any plugin with the same type number. Example:

   ```yaml
     - {name: kudan_localization_handler, type: 31, class: 'task_supervisor::KudanLocalizationHandler'}
     # - {name: pcl_localization_handler, type: 31, class: 'task_supervisor::PCLLocalizationHandler'}
   ```
2. Add a `kudan_localization_handler` section with the following parameters at the end of the file:

   ```yaml
   kudan_localization_handler:
     watchdog_rate: 2.0
     watchdog_timeout: 0
     kudan_localization_launch_package: "kdlidar_ros"
     kudan_localization_launch_file: "kdlidar_ros_pcl_localise.launch"
     move_base_launch_package: "movel"
     move_base_launch_file: "navigation_common.launch"
     localization_map_dir: "/home/movel/.config/movel/maps"
     navigation_map_dir: "/home/movel/.config/movel/maps/nav"
     kudan_localization_launch_nodes: "/obs_cloud_to_scan /kdlidar_ros_pcl /velocity_limiter /anti_shin_buster_node /rgbd_to_base /velocity_setter_node /plan_inspector"
   ```
3. Add `kudan_slam_handler` to the **plugins** section with the following lines and comment if there's any plugin with the same type number. Example:

   ```yaml
     - {name: kudan_slam_handler, type: 32, class: 'task_supervisor::KudanSlamHandler'}
     # - {name: pcl_slam_handler, type: 32, class: 'task_supervisor::PCLSlamHandler'}
   ```
4. Add a `kudan_slam_handler` section with the following parameters at the end of the file:

   ```yaml
   kudan_slam_handler:
     watchdog_rate: 2.0
     watchdog_timeout: 0.0
     save_timeout: 20.0
     map_topic: "/map"
     kudan_slam_launch_package: "kdlidar_ros"
     kudan_slam_launch: "kdlidar_ros_pcl_mapping.launch"
     kudan_map_saver_package: "task_supervisor"
     kudan_map_saver_launch: "map_saver.launch"
     three_to_two_package: "movel_octomap_server"
     three_to_two_launch: "pointcloud_grid.launch"
   ```
5. After you edit the `task_supervisor.yaml`, please restart all the docker containers by executing the following commands:

   ```
   cd ~/catkin_ws/movel_ai
   docker-compose down && docker-compose up -d
   ```

{% hint style="success" %}
Now you can do the 3D Mapping using Kudan Package by clicking the "**Mapping**" feature on Seirios RNS UI. \
If you are facing any issues and have questions, please feel free to ask by reaching us at <sales@movel.ai>
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.movel.ai/new-collection/seirios-rns/documentation/kudan-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
