GIMP를 실행하고 수정할 지도 파일 오픈
~/nav2_ws/src/neobotix/neo_simulation2/maps/aws.pgm
Rectangle Select Tool
을 통해 Keepout Filter를 적용할 영역 선택
Bucket Fill Tool
을 통해 선택한 영영의 색상을 검정색으로 채우기
[File] - [Export As…] -aws_keepout.pgm
으로 저장 후 Export
아래 코드를 통해 기존 aws.yaml
을 **aws_keepout.yaml
**으로 복사 후 지도 파일을 aws_keepout.pgm
으로 수정
cp ~/nav2_ws/src/neobotix/neo_simulation2/maps/aws.yaml ~/nav2_ws/src/neobotix/neo_simulation2/maps/aws_keepout.yaml
**image: aws_keepout.pgm # 수정**
resolution: 0.050000
origin: [-7.000, -10.500000, 0.000000]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196
aws_keepout.pgm
수정한 지도를 워크스페이스의 install 디렉토리에 추가하기 위해 패키지를 다시 빌드
cd ~/nav2_ws
colcon build --symlink-install --packages-select neo_simulation2
source ~/nav2_ws/install/local_setup.bash
위에서 수정한 지도를 이용하여 Keepout Filter를 적용하기 위해 global_costmap과 local_costmap 관련 설정 수정.
먼저 ~/nav2_ws/src/neobotix/neo_simulation2/configs/mpo_700/navigation.yaml
파일을 아래와 같이 수정
...
global_costmap:
global_costmap:
ros__parameters:
...
plugins: ["static_layer", "obstacle_layer", "inflation_layer"]
**filters: ["keepout_filter"]
keepout_filter:
plugin: "nav2_costmap_2d::KeepoutFilter"
enabled: True
filter_info_topic: "/costmap_filter_info"**
...
local_costmap:
local_costmap:
ros__parameters:
...
plugins: ["voxel_layer", "inflation_layer"]
**filters: ["keepout_filter"]
keepout_filter:
plugin: "nav2_costmap_2d::KeepoutFilter"
enabled: True
filter_info_topic: "/costmap_filter_info"
...**
~/nav2_ws/src/neobotix/neo_simulation2/configs/mpo_700/filters.yaml
파일 생성 후 코드 작성
touch ~/nav2_ws/src/neobotix/neo_simulation2/configs/mpo_700/filters.yaml
costmap_filter_info_server:
ros__parameters:
use_sim_time: true
filter_info_topic: "/costmap_filter_info"
type: 0
mask_topic: "/keepout_filter_mask"
base: 0.0
multiplier: 1.0
filter_mask_server:
ros__parameters:
use_sim_time: true
frame_id: "map"
topic_name: "/keepout_filter_mask"
yaml_filename: "/home/hee3/nav2_ws/src/neobotix/neo_simulation2/maps/aws_keepout.yaml"
nav2_msgs/CostmapFilterInfo
메시지를 Publishnav2_msgs/OccupancyGrid
메시지를 Publish~/nav2_ws/src/neobotix/neo_nav2_bringup/launch/navigation_neo.launch.py
파일을 아래와 같이 수정
navigation_neo.launch.py
(토글)