2. How to ndt mapping - tkkim-robot/SLAM_Wiki GitHub Wiki
Ndt Mapping DEMO (IF YOU WANT TO RUN DEMO ONLY)
In this section, I am explaining the DEMO of ndt mapping. If you want to run ndt mapping using your new rosbag file, please follow section: "Ndt mapping using your rosbag" !!
If you are a beginner, please see this youtube ==> https://youtu.be/ss6Blrz23h8
DEMO Rosbag File
The rosbag file I used in this DEMO, is "first.bag". The rosbag file is in humanlab NAS.
- Access NAS. The IP now in July 2019 is (10.40.4.38). You should input ID and password.
- Go to folder HumanDisk.
- Go to folder "Autoware_Data/190614_MappingData".
- Download "first.bag" to your local.
This rosbag file contains IMU, GPS, LiDAR data. It was recorded inside of DGIST.
Change topic name
The LiDAR topic of this rosbag file is not "points_raw". So you should change its topic name "velodyne_points" to "points_raw". There are some ways to do it, I will choose python implementation. If you already have "first_modified.bag" that I changed topic already, you can skip this step.
- Open any editor (gedit is fine), copy the lines below:
from rosbag import Bag
with Bag('first_modified.bag', 'w') as Y:
for topic, msg, t in Bag('first.bag'):
if topic == '/velodyne_points':
Y.write('/points_raw', msg, t)
if topic == '/imu_raw':
Y.write('/imu_raw', msg, t)
if topic == '/nmea_sentence':
Y.write('/nmea_sentence', msg, t)
- Save the python code above, and run it by python. I saved the python code as name of "change_topic_name.py". Make sure 'first.bag' file is in same directory.
python change_topic_name.py
- Check 'first_modified.bag' is created in the same directory.
We do this step because there is no way to let ndt_mapping listen topic "velodyne_points". Of course, you can use 'remap' if you can.
Clone repository
Follow commands in terminal. Clone the repository, checkout branch, build by catkin_make, source it. And by './run' you can run autoware.
cd
git clone https://github.com/sonnet-ai/autoware-nav.git
cd autoware-nav
git checkout issue2-fix/move_PC_coor
cd ros
catkin_make
source devel/setup.bash
./run
Instruction on AUTOWARE
- Go to Simulation tab and click 'ref'. Select rosbag file 'first_modified.bag' you just downloaded.
- Click "Play" and click "Pause" to set rosparam "use_sim_time" true.
- Go to Setup tab, set "rosparam:tf_yaw" to -2.1405411 . Then push "TF" and push "Vehicle Model".
- Go to computing tab, click ndt_mapping.
- Go to Simulation tab and click "Pause" to replay the rosbag.
- After finishing the mapping, click the "app" of ndt_mapping and input the name of the PCD file and filter resolution, and clock "PCD OUTOUT".
- The PCD file will be output in the directory you specified.
Ndt Mapping using your rosbag (NOT DEMO, YOUR OWN DATA!!!)
Set rotation on AUTOWARE
You can create a map contains rotation data by simply setting initial pose TF in AUTOWARE. You can change the initial pose (includes rotation) in "Setup" tab. In my case, I set "rosparam:tf_yaw" to -2.1405411. Change the value according to your rosbag file.
The rotation data you initialize in ndt_mapping must be the first rotation in /gnss_pose in your rosbag file. You can check it by
$ rostopic echo (your topic, in my case /gnss_pose)
in terminal. In my BAG file, the rotation was represented in quaternion (x,y,z,w). So I transformed it into (roll, pitch, yaw). As a reference, here is the online quarternion to euler converter link I used : https://quaternions.online
Instruction on AUTOWARE
- Go to Simulation tab and select a rosbag which includes /points_raw. If the LiDAR topic is /velodyne_points, you should change topic name by "remap" in ROS or by python implementation.
- Click "Play" and click "Pause" to set rosparam "use_sim_time" true.
- Go to Setup tab, input parameters related to relative position between the vehicle and localizer. You must set the initial rotation value of your rosbag file, as explained above. Then push "TF" and push "Vehicle Model" (if you leave the space blank, the default model will be loaded.).
- Run ndt_mapping, go to Simulation tab and click "Pause" to replay the rosbag.
- After finishing the mapping, click the "app" of ndt_mapping and input the name of the PCD file and filter resolution, and clock "PCD OUTOUT".
- The PCD file will be output in the directory you specified.