Skip to content

ggupta9777/simple_line_follower

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Line Follower

About

This repository demonstrates a basic line-following robot which uses a Proportional-Derivative Controller.

This ROS 2 package is used to demonstrate these examples :

Dependencies

  • Ubuntu 22.04
  • ROS 2 Humble
  • Ignition Gazebo(Fortress)
  • bcr_bot

Installation

  1. Clone this repository

    git clone git@github.com:ggupta9777/simple_line_follower.git
  2. Clone bcr_bot

    git clone git@github.com:blackcoffeerobotics/bcr_bot.git
  3. Install dependencies using rosdep:

    rosdep install --from-paths src -y --ignore-src
  4. Build the packages with test config(Note : The `--cmake-args`` used above are to enable code coverage analysis)

    colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Debug   -DCMAKE_CXX_FLAGS="--coverage" -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON

Run instructions

  1. Launch bcr_bot

    ros2 launch bcr_bot gz.launch.py \
        camera_enabled:=True \
        stereo_camera_enabled:=False \
        two_d_lidar_enabled:=True \
        position_x:=0.0 \
        position_y:=0.0  \
        orientation_yaw:=0.0 \
        odometry_source:=world \
        world_file:=empty.sdf
  2. Run the line follower node

    • Run the line_follower_node

      ros2 run simple_line_follower line_follower_node --ros-args --params-file src/simple_line_follower/config/params.yaml
    • Run the naive_line_follower_node

      ros2 run simple_line_follower naive_line_follower_node --ros-args --params-file src/simple_line_follower/config/params.yaml

Running Tests

  • Run the test scripts(Note : The --event-handler=console_direct+ argument is used to show the logs of the testing process)

      colcon test --event-handler=console_direct+

Generate Code Coverage

  1. Use lcov to generate code coverage

    lcov --capture --directory build/ --output-file code_coverage_report.info
  2. Generate an HTML file to showcase the code coverage report

    genhtml code_coverage_report.info --output-directory html_code_coverage_report
  3. Open the code coverage on your browser

    sensible-browser html_code_coverage_report/index.html

Topics

  • /bcr_bot/cmd_vel : This topic is used to publish velocity messages to the bot in Gazebo
  • /bcr_bot/odom : This topic is used to obtain odometry information regarding the bot

Demo

This is a demo of the bot following a line defined by the waypoints : (0, 1, 0) and (5, 1, 0)