환경 구성을 위해 필요한 요소 설치
sudo apt update && sudo apt install -y \\
build-essential \\
cmake \\
git \\
libbullet-dev \\
python3-colcon-common-extensions \\
python3-flake8 \\
python3-pip \\
python3-pytest-cov \\
python3-rosdep \\
python3-setuptools \\
python3-vcstool \\
openssh-server \\
wget
워크스페이스를 구성하고 필요한 리소스들을 가져오기
mkdir -p ~/nav2_ws/src
cd ~/nav2_ws/
wget <https://raw.githubusercontent.com/Adlink-ROS/neuronbot2_ros2.repos/humble/neuronbot2_ros2.repos>
vcs import src < neuronbot2_ros2.repos
워크스페이스 안의 모든 의존성 패키지 설치
cd ~/nav2_ws/
rosdep update
rosdep install --from-paths src --ignore-src -r -y --rosdistro humble
워크스페이스 내 패키지들을 빌드
cd ~/nav2_ws/
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
source ~/nav2_ws/install/local_setup.bash # 또는 새 터미널 열기
.bashrc
또는 .zshrc
에서 워크스페이스를 이미 등록하였습니다.ros2 launch neuronbot2_gazebo neuronbot2_world.launch.py
neuronbot2_world.launch.py
의 28번째 줄의 파일을 수정하여 world를 바꿀 수 있음
Mememan world (mememan_world.model
) / Phenix world (phenix_world.model
)
ros2 run teleop_twist_keyboard teleop_twist_keyboard
아래 SLAM 기법들 중 하나를 선택하여 런치 파일을 실행
ros2 launch neuronbot2_slam gmapping_launch.py open_rviz:=true use_sim_time:=true
ros2 launch neuronbot2_slam slam_toolbox_launch.py open_rviz:=true use_sim_time:=true
# neuronbot2/neuronbot2_slam/cartographer_launch.py에서
# occupancy_grid_node -> **cartographer_occupancy_grid_node 수정**
...
Node(
package='cartographer_ros',
**executable='cartographer_occupancy_grid_node', # 수정!!!**
name='occupancy_grid_node',
output='screen',
parameters=[{'use_sim_time': use_sim_time}],
arguments=['-resolution', resolution, '-publish_period_sec', publish_period_sec]),
...
ros2 launch neuronbot2_slam cartographer_launch.py open_rviz:=true use_sim_time:=true
teleop_twist_keyboard
노드를 통해 지도 완성
ros2 run teleop_twist_keyboard teleop_twist_keyboard