# 使用Hokuyo_LX30做gmapping
==學習ROS的過程是痛並快樂著==:smiley:
# DEBIUGGING : Tutorial/indigo/Adding a ladar to the turtlebot...
There are some bugs in the "Step2. Plugin the sensor"
Lidar= Hokuyo UTM-30LX
ROS Distro= kinetic
Edit the 50-hokuyo.rules
```javascript=
$sudo gedit /etc/udev/rules.d/50-hokuyo.rules
```
>KERNEL=="ttyACM[0-9]*", ACTION=="add", ATTRS{idVendor}=="15d1",
MODE="0666", GROUP="dialout",
PROGRAM="/opt/ros/kinetic/env.sh rosrun urg_node getID %N q",
SYMLINK+="sensors/hokuyo_%c"
It looks like above, and there are 2 points to custom in this code
1. the ROS Distro version: ==/opt/ros/**kinetic**/env.sh==
2. the node: ==rosrun **urg_node** getID %N==
-> For the Indigo distro, use **hokuyo_node**
-> For newer ROS distro than Indigo, use **urg_node**
Then reload the UDEV rules using
```javascript=
$ sudo udevadm control --reload
```
Finally unplug and replug the sensor so that new rules take effect.
This should set the correct permissions and additionally create a symbolic link under ==/dev/sensors/hokuyo_XXXXXXX== in case a specific sensor needs to be specified.
---
## 下載包
:::warning
sudo apt-get install ros-kinetic-urg-node
:::
## 新建啟動文件
:::warning
待新增
:::
---
## 指令
1. 建地圖
```javascript=
roslaunch turtlebot_bringup minimal.launch
roslaunch turtlebot_navigation gmapping_demo.launch
roslaunch turtlebot_teleop keyboard_teleop.launch
roslaunch turtlebot_rviz_launchers view_navigation.launch
```
2. 存地圖
```javascript=
rosrun map_server map_saver -f /home/nvidia/map/{map_name}
ls ~/map
```
3. 導航
```javascript=
roslaunch turtlebot_bringup minimal.launch
roslaunch turtlebot_navigation amcl_demo.launch
map_file:=/home/nvidia/map/{map_name}.yaml
roslaunch turtlebot_rviz_launchers view_navigation.launch
```
___
## TF-tree
:::warning
待新增
:::
---
## Gmapping build map (KOBUKI+Hokuyo_30XL)
{%youtube nIPrOnASgv8 %}
## Wrong Gmapping build map (KOBUKI+Hokuyo_30XL)
{%youtube 6B-5RhxVQrM %}
---
## Navigation (KOBUKI+Hokuyo_30XL)
{%youtube IF1ceEKl5Qs %}