This is a ROS Package for controlling mobile robots. It was inspired by and borrows a lot of ideas from the Control of Mobile Robots MOOC by Dr. Magnus Egerstedt.
- TurtleBot3 Waffle is used as the robot.
- Hybrid Automata with Go To Goal, Obstacle Avoidance and Follow Wall modes governed by SlidingModeSwitch are implemented.
- ROS Melodic with Gazebo-9 (Desktop-Full Install)
- TurtleBot3 package for ROS Melodic.
- Clone the contents of this repository to the
src/folder of your catkin workspace. - Navigate to your catkin workspace folder.
- Invoke
catkin_makein your terminal at the root of the catkin workspace. - Check if the compilation was successful by invoking
rospack find mobile_robot_controllerin your terminal. It should print out the location of themobile_robot_controllerfolder.
*=Goal Point
You can try out the package by following these steps:
-
Load the Gazebo Environment. By default, the world is empty. You can add obstacles using the
inserttab in Gazebo or changing theturtlebot3_world.worldfile in theworlds/folder.$ roslaunch mobile_robot_controller turtlebot3_world.launch -
Start the
mr-controllernode. The default goal location is[3.0,-2.0]. You can change this by modifying the variablex_dandy_din themr-controller.cppfile.$ rosrun mobile_robot_controller mr-controller_node -
Watch the robot go to the goal location and avoiding obstacles on the way.
Although this package is written for the Turtlebot3 Waffle robot, it can be easily modified for controlling any custom mobile robot.
- The package has 2 main files:
mr-controller.cppandhybridAutomata.h. - The
mr-controller.cppfile is responsible for the ROS side of the controller. It subscribes to the/scantopic for the Lidar Scan and/odomtopic for the robot odometry. The node publishes on velocity commands on the/cmd_veltopic. All topics use the standard ROS message types. For a custom robot, these are the topics that need to be set. - The
hybridAutomata.hfile is where the switching logic resides. The classhybrid_automatais what you can modify to implement your own custom switching logic.
- Add demo clips.
- Add examples for wall following.
- Change PID control from hardcode to ROS PID package.
- Add support for custom goal points using
Rviz: 2D Nav Goal.
My wholehearted thanks to Georgia Tech and Coursera for putting up this amazing walkthrough course on controlling mobile robots. Dr. Magnus Egerstedt has done a brilliant job in explaining each concept part by part and finally combining them for getting sense of the bigger picture. I definitely recommend this course to any robotics enthusiast.
