---
# System prepended metadata

title: PEV odom setting

---

# PEV odom setting

### 0. Preparation
+ Hardware rule
  - Velodyne
  - VESC (middrive & steering)
  - Encoder of rear wheel
  - IMU
  - RTK GPS
  
+ Topics
  - /velodyne_points
  - VESC (middrive & steering)
  - ENCODE
  - /xsense_imu/imu/data
  - /tcpfix



### 1. Collect data
> [color=#3198a0]1.1. Collecting data
> ```javascript=
> roslaunch pev_sensors start_sensor.launch 
> roslaunch pev_sensors bag_file.launch file_name:=XXX.bag
> ```


> [color=#3198a0]1.2 Check data
> ```javascript=
> roscore
> rosbag play --clock -l XXX.bag
> rqt_bag
> ```
---
### 2. Build a map
> [color=#3198a0]2.1 Build a map
> ```javascript=
> roslaunch ndt_localizer ndt_mapping.launch 
> roslaunch pev_map_server pointcloud_to_pcd.launch file_name:=XXX
> cd ~/pev_ws/src/map_tool_standalone/pcl_filters/build
> ./filters ~/pcd/XXX.pcd ~/pcd/XXX_50cm
> {編輯pev_map_server map_tf_finder_3d.launch 更改指定輸入XXX_50cm與.gps,
> 並且指定輸出的ooo.yaml檔名}
> roslaunch pev_map_server map_tf_finder_3d.launch
> {有時候rviz出現後,衛星圖會error,此時將左邊選單的AerialMapDisplay的勾勾取消後,在重新點選即可}
> {在跳出rviz視窗進行疊圖校正,完成疊圖後,中心灰色區域按右鍵,選取"save tf parameter",即會產生指定的ooo.yaml}
> ``` 

![](https://i.imgur.com/DL8oQze.jpg)

---
> [color=#3198a0]2.2 Visualize a path
> ```javascript=
> {修改roscd pev_odom的pev_3d_localization_ndt.launch,
> 更改要指定輸入的bag檔名（xxx.bag),以及更改指定輸入的yaml檔名（ooo.yaml）}
> {修改roscd pev_map_server的pcd_map_loader.launch,
> 更改指定輸入的yaml檔名（ooo.yaml）}
> {修改roscd ndt_localizer的ndt_mapping.launch,
> 更改要指定輸入的bag檔名（xxx.bag)}
> roslaunch pev_odom pev_3d_localization_ndt.launch debug:=true
> ```
==roslaunch pev_odom pev_3d_localization_ndt.launch debug:=true (debug=true的時候代表會用到bag,適合在電腦沒有連接pev時使用;debug=false的時候代表不用bag,適合直接電腦連接pev的時候用)==

![](https://i.imgur.com/IiIPiT4.jpg =700x)

---
> [color=#3198a0]2.3 Generate a path
> ```javascript=
> {修改roscd pev_path的path_saver_3d_global.launch,
> 更改要指定輸入的bag檔名（xxx.bag),以及更改指定輸入的yaml檔名（ooo.yaml）}
> roslaunch pev_path path_saver_3d_global.launch
> {當rviz跑完車子之前的路徑,點下rviz的2D NAV GOAL,
> 依照車子原本動線選取起點方向與終點方向(方向要與原本一樣,且箭頭要很準的在path線上),
> 點選rviz中的路徑產生（紅線）一條(只取一條path,所以越長越好,代表之後可走路徑範圍)}
> rosservice call /save_path "file_name: 'zzz'" 
> ```

![](https://i.imgur.com/SWm4Q91.png =700x)

==Make sure that path# is 1==
![](https://i.imgur.com/DoJqLD1.png =700x)
