This is a project to timely export the trajectory in a SLAM project to a .txt file in TUM format.
Ubuntu 64-bit 18.04 or 20.04. ROS Melodic or Noetic. ROS Installation
Because the coordinate system naming of the SLAM system may be different, this needs to be changed.
trajectorysave.cpp lines 26 and 28 :
listener.waitForTransform("/camera_init", "/aft_mapped", ros::Time(0), ros::Duration(1));
listener.lookupTransform("/camera_init", "/aft_mapped", ros::Time(0), transform);
Change "/camera_init"
and "/aft_mapped"
to the new coordinate system.
- You can view the coordinate system of the current SLAM system through the following command:
rosrun rqt_tf_tree rqt_tf_tree
listener.waitForTransform("/map", "/base_link", ros::Time(0), ros::Duration(1));
listener.lookupTransform("/map", "/base_link", ros::Time(0), transform);
Clone the repository and catkin_make:
git clone https://github.com/Zjj587/Trajectory_saving_for_SLAM.git
cd Trajectory_saving_for_SLAM
catkin_make
source devel/setup.bash && rosrun test_pkg save_traj_as_tum
To run Example, you need to install and configure Point-LIO and evo. And no need to change the code.
# termianl 1: run Foint-LIO
roslaunch point_lio mapping_avia.launch
# terminal 2: run save_traj_as_tum
rosrun test_pkg save_traj_as_tum
# terminal 3: play data
rosbag play yourbag.bag
After running:
cd ~/save_traj
evo_traj tum test.txt -p