My Bot

Check out the live demo on github: https://github.com/Duks31/my_bot/

Diff Drive Robot Using ROS2, Gazebo, Rviz2 and Fusion 360

Description Link to heading

This repository contains the ROS2 implementation for a differential drive robot. The package includes nodes for controlling the robot, simulating its motion.

System Requirements Link to heading

  • Ubuntu 20.04
  • >= ROS2 Humble
  • Python 3.XX

Repository Structure Link to heading

my_bot
├── CMakeLists.txt
├── LICENSE.md
├── README.md
├── config
│   ├── drive_bot.rviz
│   ├── empty.yaml
│   ├── my_controllers.yaml
│   └── view_bot.rviz
├── description
│   ├── gazebo_control.xacro
│   ├── inertial_macros.xacro
│   ├── robot.urdf.xacro
│   ├── robot_core.xacro
│   └── ros2_control.xacro
├── launch
│   ├── launch_sim.launch.py
│   └── rsp.launch.py
├── log
│   ├── COLCON_IGNORE
│   ├── latest -> latest_list
│   ├── latest_list -> list_2024-11-25_17-22-41
│   └── list_2024-11-25_17-22-41
│       └── logger_all.log
├── package.xml
└── worlds
    ├── empty.world
    └── obstacles.world

Installation and Build Instructions Link to heading

  1. Make a ros2 workspace and initialize it
   mkdir -p ~/my_bot_ws/src
   cd ~/my_bot_ws
   colcon build
   source install/setup.bash
  1. Clone the repository
    cd ~/my_bot_ws/src
    git clone https://github.com/Duks31/my_bot
  1. Navigate to the workspace and build the package
    cd ~/my_bot_ws
    colcon build
  1. Install dependencies and build the workspace
    cd ~/ros2_ws
    rosdep install --from-paths src --ignore-src -r -y
    colcon build
    source install/setup.bash
  1. Run the simulation
    ros2 launch my_bot launch_sim.launch.py world:=./src/my_bot/worlds/obstacles.world
  1. Remap and run the teleop node
    ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r /cmd_vel:=/diff_cont/cmd_vel_unstamped
  1. Visualize the robot in RViz2 (Optional)
    • Open a new terminal and run the following command
    Rviz2
    
    • In RViz2, set the Fixed Frame to odom and add the RobotModel to visualize the robot.
    • Add tf and RobotModel to visualize the robot in RViz2.

Robot Description (URDF) Link to heading

diff_drive v4

The robot’s URDF (Unified Robot Description Format) file was initially designed using Autodesk Fusion 360. The 3D model of the robot was created in Fusion 360, which provided an accurate representation of the robot’s physical dimensions, joints, and links.

  1. Modeling in Fusion 360:

    • The robot’s physical design, including the chassis, wheels was created in Fusion 360.
    • The 3D model was exported as a URDF file for integration into ROS.
  2. Conversion to URDF:

    • The exported model was processed using fusion2urdf into a URDF file.
    • Additional features like collision and visual properties were added to make the robot compatible with Gazebo simulation and ROS visualization tools (e.g., RViz2).

Nodes and Launch Files Link to heading

Nodes Link to heading

  1. robot_state_publisher

    • Publishes the robot’s URDF to the /robot_description topic.
    • Key Parameters:
      • robot_description: Processed URDF description of the robot.
      • use_sim_time: Enables simulated time for Gazebo.
  2. spawn_entity.py

    • Spawns the robot into the Gazebo simulation.
    • Arguments:
      • -topic robot_description: Specifies the URDF topic.
      • -entity my_bot: Unique name for the robot in the simulation.
  3. diff_drive_controller/DiffDriveController

    • Controls the differential drive system by translating velocity commands to wheel motions.
    • Key Parameters:
      • wheel_separation: 0.35 m
      • wheel_radius: 0.05 m
  4. joint_state_broadcaster/JointStateBroadcaster

    • Publishes joint states (position, velocity) to the /joint_states topic.

Launch Files Link to heading

  1. launch_sim.launch.py

    • Launches the simulation with the following components:
      • Robot State Publisher: Publishes the robot description.
      • Gazebo: Starts the simulation environment.
      • Robot Spawner: Adds the robot to the simulation.
      • Controller Spawners: Launches the diff_drive_controller and joint_state_broadcaster.
    • Command:
      ros2 launch my_bot launch_sim.launch.py
      
  2. rsp.launch.py

    • Configures and launches the robot_state_publisher node.
    • Processes the robot.urdf.xacro file.
    • Command:
      ros2 launch my_bot rsp.launch.py use_sim_time:=true
      

Worlds Link to heading

  • obstacles.world: This world file is used to simulate the robot in a world with obstacles.

Acknowledgments Link to heading