Welcome to the GitHub repository for a straightforward yet versatile robotics project! This repository hosts the code and simulation files for a 2-wheel robot with a caster, equipped with a lidar sensor for environment mapping using various SLAM (Simultaneous Localization and Mapping) packages.
Key Features:
-
Robot Design: The robot's mechanical design was crafted using Fusion 360, providing a detailed and realistic representation of the physical robot. The model was then exported as a URDF (Unified Robot Description Format) file for simulation purposes.
-
Simulation Environment: The robot comes to life in the Gazebo simulator, featuring a realistic physics engine for accurate behavior. Rviz is integrated into the simulation setup for visualizing sensor data and robot movements.
-
Mapping Capability: Gmapping SLAM package has been employed for mapping the environment. The robot, equipped with a lidar sensor, creates a 2D occupancy grid map of its surroundings, aiding in understanding and navigating within the simulated world.
-
Custom Gazebo World: To enhance the simulation experience, a custom world with various objects has been created in Gazebo. This allows for a more diverse testing environment, simulating real-world scenarios.
-
Teleoperation Control: While the robot does not possess autonomous navigation capabilities, it can be controlled using the teleop_key package. This enables users to remotely control the robot's movement, making it a hands-on and interactive experience.
How to Use:
-
Clone this repository to your local machine using the following command:
git clone https://github.com/aaqibmahamood/A-Simple-Diff-Drive-Robot.git
-
Follow the provided documentation in the repository to set up the simulation environment and launch the robot in Gazebo along with Rviz.
-
Control the robot using the teleop_key package to explore the simulated environment and observe its mapping capabilities.
Reporting Issues: If you encounter any issues or have suggestions for improvement, please raise an issue on the GitHub repository. Your feedback is valuable, and I will actively work to address and resolve any problems you may encounter.
Happy simulating!
Your stars, forks and PRs are welcome!
diff-drive.mp4.mp4
Tested on ubuntu 20.04 LTS with ROS Noetic.
-
Install ROS (Desktop-Full suggested).
-
Install git.
sudo apt install git
-
Other dependence.
sudo apt-get install ros-noetic-joy ros-noetic-teleop-twist-joy ros-noetic-teleop-twist-keyboard ros-noetic-amcl ros-noetic-map-server ros-noetic-move-base ros-noetic-urdf ros-noetic-xacro ros-noetic-rqt-image-view ros-noetic-gmapping ros-noetic-navigation ros-noetic-robot-state-publisher ros-noetic-dwa-local-planner ros-noetic-joint-state-publisher-gui
-
Clone this reposity.
cd catkin_ws/src git clone https://github.com/aaqibmahamood/A-Simple-Diff-Drive-Robot.git
-
Compile the code.
cd /catkin_ws catkin_make # or # catkin build # you may need to install it by: sudo apt install python-catkin-tools
Modelled in Fusion 360
Links and Joints:
- base_link
- lidar_1
- right_wheel_1
- left_wheel_1
- caster_1
*Both the right wheel and left wheel have been assigned Revolute Joints and lidar_1 has been assigned Rigid Joint with respect to base_link. Exported URDF file from Fusion360 using URDF_Exporter plugin.
Run ROS Master
roscore
To Load the Robot in Gazebo simulator and rviz use the following commands in separate terminals:
- Load Robot in Gazebo
roslaunch rmpbot01_description gazebo.launch
- Start Rviz for visualisation
rviz
- Run Launch file having Gmapping Package
roslaunch rmpbot01_description mapping.launch
- Add Robot Model in Rviz
The ~/catkin_ws/src/myrobot_control/scripts folder contains the myrobot_key node, which is the teleop node. There is already a standard teleop node implementation available (for the turtlebot), we simply reused the node. Then a remapping is done from the turtlebot_teleop_keyboard/cmd_vel to /cmd_vel of our robot in the keyboard_teleop.launch file.
To drive around the robot for mapping the world use teleop_twist_keyboard package - Open another terminal and run the following commands:
- Start the teleop node:
roslaunch teleop_twist_keyboard teleop_twist_keyboard.py
Here are some keyboard controls for Teleop Twist Keyboard:
Notice that the teleop node receives keypresses only when the terminal window is active.