Building an Autonomous Rover using ROS

Jul 21, 2024

Building an Autonomous Rover using ROS

Introduction

  • Building an autonomous rover from scratch using ROS.
  • Delays due to various issues like shipping times, battery problems, and design changes.
  • Brief mention of a robotic arm project.

Changes and Updates

  • Changed battery types several times due to failures, fires, and boot loop issues.
  • Settled on using a 10000mAh Mi Power Bank.
    • Advantages: fast charging, three outputs, switchable to USB-C power delivery.
    • Usage: one output to motors via a DC-DC boost converter, one to Raspberry Pi, one for future LiDAR.

Moving Forward with the Project

  • Previously wrote code for basic movement (forward and backward).
  • Introduced differential drive system for more complex navigation.
    • Differential drive: two wheels actuated by motors on the same axis, varying motor speeds for directions.
    • Same direction = straight movement, opposite direction = rotation.
    • Key terms: ICC (Instantaneous Center of Curvature), radius (r), linear velocity (v_linear), angular velocity (v_omega).
    • Key equations:
      • v_l = v_linear - (v_omega * L / 2)
      • v_r = v_linear + (v_omega * L / 2)
    • Used to translate the robot's velocity to individual wheel velocities.

Introduction to ROS

  • ROS (Robot Operating System): Middleware, not an OS.
    • Origin: Problem of re-implementing software stacks in robotics.
    • Developed by two people from Stanford at Willow Garage, PR2 robot project.
    • Now maintained by OSRF (Open Source Robotics Foundation).
  • Components:
    • ROS Master: Registers and manages nodes (single executable programs).
    • Communication methods:
      • Topics: Nodes publish to/subscribe from (message-based).
      • Services: Request-response method.
  • Infrastructure: Raspberry Pi (slave) and main computer (master).
  • Installation and setup well documented on the ROS website.

Writing the Final Arduino Program

  • Objective: Create a ROS node on the Arduino to control the robot.
  • Key components:
    • Header files: ros, ros time, message headers, and PID library.
    • PID Controllers: Ensure motors move at the same speed.
      • Set up P, I, D parameters; compare actual speed with desired speed.
      • Two PID controllers (one for each wheel).
    • ROS Subscriber and Publisher nodes:
      • Subscriber: /cmd_vel (command velocity) topic for receiving linear and angular velocities from ROS.
      • Publishers: /lwheel and /rwheel for current wheel positions.
    • Loop function: Use encoder counts and PID controller output to adjust motor speeds.
    • Use ROS serial python and teleop twist keyboard packages for integration.
  • Process:
    • Connect Arduino to Pi, Pi to main computer via SSH.
    • Run necessary ROS packages and commands to start the ROS nodes and control the robot.

Setting Up Differential Drive Workspace

  • Structure: Workspace (ws_rover_ws), source directory (src), initialize with catkin init, build with catkin make.
  • Add differential drive package and create a new package for the rover.
  • Use VS Code for remote SSH workspace.
  • Create ROS launch file (drive.launch) to run multiple nodes.
    • Nodes: rosserial_python and differential_drive_tf.
  • Run launch files, start RViz for visualization.
  • Use teleop twist keyboard for manual control.

Conclusion

  • Summarized various steps and challenges faced throughout the project.
  • Highlighted the importance of tuning parameters for optimal odometry.
  • Encouraged viewers to apply the information to their projects.