Project for controlling an autonomous boat in simulation.
The project is made by ROS 2 framework, called boat_navigation and it is tested in VRX (Virtual RobotX) / Gazebo simulation.
The main idea is simple: the boat should go to a target position and try to avoid obstacles using a potential field controller.
- ROS 2 node (C++):
boat_controller_node - Launch files (Python):
launch/boat_vrx.launch.pylaunch/full_simulation.launch.py
- Uses VRX topics like:
/wamv/sensors/lidars/lidar_wamv_sensor/scan(LiDAR)/wamv/sensors/gps/gps/fix(GPS)/wamv/sensors/imu/imu/data(IMU)- Thrusters:
/wamv/thrusters/left/thrust/wamv/thrusters/right/thrust
This repo is a ROS 2 (ament_cmake) package. You need:
- ROS 2 installed (I used ROS 2 style build with
colcon) - VRX /
vrx_gzpackage installed (VRX Gazebo) rviz2(optional)
Dependencies from package.xml:
rclcppgeometry_msgsnav_msgssensor_msgstf2tf2_geometry_msgs
Example workspace structure:
ws_boat/
src/
boat_navigation/ <-- this repository
Build:
cd ~/ws_boat
colcon build --symlink-install
source install/setup.bashThis starts VRX + then starts my controller node with a small delay:
ros2 launch boat_navigation full_simulation.launch.pyYou can also pass arguments (world/target), for example:
ros2 launch boat_navigation full_simulation.launch.py world:=scan_dock_deliver_task.sdfros2 launch boat_navigation boat_vrx.launch.py- I read LiDAR + GPS + IMU.
- I compute a force:
- attraction force to target
- repulsion force from obstacles
- From that force I compute desired heading (yaw).
- Then I publish thrust commands to left/right thrusters (differential drive idea).
This is not perfect, but it works as a good simulation demo.
