This document lists all the unique ROS 2 commands used during the SLAM-based autonomous vehicle project. Each section includes a brief description of the purpose and function of the commands.
These commands are used to perform SLAM mapping and save the generated maps.
ros2 run slam_toolbox async_slam_toolbox_node \
--ros-args -p scan_topic:=/scan \
-p publish_transform:=true \
-p odom_frame:=odom \
-p base_frame:=base_link \
-p map_frame:=mapNote: Set
odom_frametoodomfor proper map updating.
ros2 run nav2_map_server map_saver_cli -f ~/map2Saves the generated map to the specified location.
ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 base_link laser --ros-args -p use_sim_time:=falsePublishes a static transform between base_link and laser frames.
ros2 launch rf2o_laser_odometry rf2o_laser_odometry.launch.pyLaunches the RF2O laser odometry package to provide odometry information.
ros2 run teleop_twist_keyboard teleop_twist_keyboardAllows manual teleoperation of the robot using keyboard input.
Commands to save maps and launch the navigation stack.
ros2 run nav2_map_server map_saver_cli -f ~/map_homeSaves the home environment map.
ros2 launch nav2_bringup bringup_launch.py \
map:=/home/ashish/ros2_ws/src/nav2_custom_launch/maps/map_home.yaml \
use_sim_time:=false \
autostart:=trueLaunches the Navigation2 stack with the saved home map.
ros2 launch my_robot_description display.launch.pyDisplays the robot model in RViz.
Commands to run SLAM toolbox in localization mode and launch the navigation stack.
ros2 run slam_toolbox async_slam_toolbox_node \
--ros-args -p scan_topic:=/scan \
-p mode:=localization \
-p publish_transform:=true \
-p odom_frame:=odom \
-p base_frame:=base_link \
-p map_frame:=mapRuns SLAM toolbox in localization mode using an existing map.
ros2 launch nav2_bringup bringup_launch.py \
map:=/home/ashish/map_lab.yaml \
use_sim_time:=false \
autostart:=trueLaunches the navigation stack with the specified lab map.
ros2 launch nav2_bringup bringup_launch.py \
map:=/home/ashish/map_lab.yaml \
params_file:=/home/ashish/ros2_ws/src/nav2_custom_launch/params/nav2_params.yaml \
use_sim_time:=false \
autostart:=trueLaunches the navigation stack with custom parameter files.
ros2 launch nav2_custom_launch nav2_navigation_only.launch.py use_sim_time:=falseLaunches only the navigation components without map server or localization.
This is the step-by-step sequence of commands executed on the virtual machine.
- Publish static transform
ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 base_link laser --ros-args -p use_sim_time:=false- Launch RF2O Laser Odometry
ros2 launch rf2o_laser_odometry rf2o_laser_odometry.launch.py- Launch Robot Description
ros2 launch my_robot_description display.launch.py- Run Map Server
ros2 run nav2_map_server map_server --ros-args -p yaml_filename:=/home/ashish/map_lab.yaml- Start SLAM Toolbox in Localization Mode
ros2 run slam_toolbox async_slam_toolbox_node \
--ros-args -p scan_topic:=/scan \
-p mode:=localization \
-p publish_transform:=true \
-p odom_frame:=odom \
-p base_frame:=base_link \
-p map_frame:=map- Bring up Navigation Stack with Ackermann Parameters
ros2 launch nav2_bringup bringup_launch.py \
map:=/home/ashish/map_lab.yaml \
params_file:=/home/ashish/ros2_ws/src/nav2_custom_launch/params/ackermann_only_params.yaml \
use_sim_time:=false \
autostart:=true- (Optional) Start SLAM Toolbox with Pre-saved Map and Dock Mode
ros2 run slam_toolbox async_slam_toolbox_node \
--ros-args -p scan_topic:=/scan \
-p mode:=localization \
-p publish_transform:=true \
-p base_frame:=base_link \
-p odom_frame:=odom \
-p map_frame:=map \
-p map_file_name:=/home/ashish/maps/map_lab_test_data \
-p map_start_at_dock:=true \
-p use_sim_time:=false