Coder Social home page Coder Social logo

ggupta9777 / simple_line_follower Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 1.0 1.26 MB

Demonstration of ROS2 unit-tests with example of a line follower robot

Home Page: https://www.blackcoffeerobotics.com/blog/unit-tests-for-robotics-software-quality-over-quantity

CMake 13.95% C++ 86.05%
colcon gtest ros2 testing

simple_line_follower's Introduction

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 [email protected]:ggupta9777/simple_line_follower.git
  2. Clone bcr_bot

    git clone [email protected]: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)

simple_line_follower's People

Contributors

ggupta9777 avatar topguns837 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hazeezadebayo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.