This project implements a wall-following algorithm in python for differential drive 2 wheeled robot with a laser scanner sensor using the Robot Operating System 2 (ROS2) libraries, Ignition Gazebo as simulator and Python as programming language. The proposed wall-following algorithm makes a robot wander at random until a wall is found, then follows the wall - through an implemented control to keep a constant distance from it in the outside of a question mark shaped “?" wall, stoping at the bottom dot.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Ubuntu 22.04 - Operating System
- ROS2 Iron - Set of software libraries and tools used to build and interact with the robot
- Ignition Gazebo Fortress - Tool used to simulation
- Python 3.10.12 - Programming language
After clone the project navigate to the project folder
cd ros2_ws/
Run colcon build check here how to setup colcon
colcon build
Return to the project folder
ros2 launch IR_assignment1_controller simulation_launch.py
To run the with multiple terminals it will be necessary to use 4 (or 5) different terminals. Follow the steps starting at project root folder.
Do not close this terminal
- Run the command to change to the world workspace:
cd ros2_ws/src/IR_assignment1_controller/worlds/
- Launch the simulation world:
ign gazebo environment.sdf
Do not close this terminal
- Run the command to setup the lidar bridge:
ros2 run ros_gz_bridge parameter_bridge lidar@sensor_msgs/msg/LaserScan[ignition.msgs.LaserScan
Do not close this terminal
- Run the command to setup the command bridge:
ros2 run ros_gz_bridge parameter_bridge cmd_vel@geometry_msgs/msg/Twist]ignition.msgs.Twist
Do not close this terminal
- Change to the base workspace:
cd ../../..
- Build the environment:
colcon build
- Run the wall-following script:
ros2 run IR_assignment1_controller wall_follower
- Run rviz2 to see the lidar measurments:
rviz2
-
Select add at the bottom left, and then select laserscaner and click Ok.
-
Change the fized frame parameter to: "vehicle_blue/chassis/gpu_lidar"
- Tiago Fonseca up202302320