This project leverages the Linorobot2 platform and the Nav2 framework to implement autonomous navigation and affective mapping in dynamic, unstructured environments. Our goal is to enable a simple four-wheeled robot to intelligently explore hazardous areas, build a map using SLAM, and navigate safely without human intervention. By integrating perception, planning, and control within a Dockerized ROS2 environment, this project demonstrates practical applications of robotics software and highlights the potential of autonomous systems in real-world, high-risk scenarios.
- Build Docker Image:
docker build -f <DockerfileName> -t <YourDockerImage:Tag> .- Create & run docker container from image:
xhost +local:root &&
docker run -it --rm \
-e DISPLAY=$DISPLAY \
-e QT_X11_NO_MITSHM=1 \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
--device=/dev/dri \
--privileged \
<YourDockerImage:Tag> - open container in different window:
docker exec -it <ContainerID> bash#Note: Find the ID or name using: docker ps
-
Start Gazebo with 4WD base in Building.world: ros2 launch linorobot2_gazebo gazebo.launch.py robot_base:=4wd use_sim_time:=true world:=/ros2_ws/src/worlds/Building.world
-
Start RViz with robot description and TF: ros2 launch linorobot2_description description.launch.py rviz:=true use_sim_time:=true
Optional(Gazebo does this): Launch EKF for Odometry Fusion: ros2 launch linorobot2_navigation ekf.launch.py use_sim_time:=true
-
Start SLAM Toolbox to build a map: ros2 launch slam_toolbox online_async_launch.py
-
Drive the robot manually using teleop (in a separate terminal): ros2 run teleop_twist_keyboard teleop_twist_keyboard Note: Explore the map fully before saving
-
Save the generated map: ros2 run nav2_map_server map_saver_cli -f /ros2_ws/src/maps/map
-
TEMPORARILY publish a static transform from map to odom (required to use 'map' as the fixed frame in RViz): ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 map odom
-
Launch the full Nav2 stack with your saved map: ros2 launch nav2_bringup bringup_launch.py map:=/ros2_ws/src/maps/map.yaml use_sim_time:=true
-
In RViz:
- Use the "2D Pose Estimate" tool to set the robot's rough location on the map.
- Make sure the "Fixed Frame" is set to "map".
-
In RViz:
- Use the "Nav2 Goal" (2D Nav Goal) tool to send a destination on the map.
- Watch the robot navigate autonomously!
Notes:
- Run each launch command in a separate terminal inside the container.
- Ensure Gazebo and RViz have access to your display (e.g., use
-e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unixwhen running the container). - If AMCL reports pose errors, ensure the initial pose is in the "map" frame and simulation time is being used.