Coder Social home page Coder Social logo

ros2_beginner_tutorials's Introduction

ROS2_Beginner_Tutorials

ENPM808X Assignment on ROS2 Basics

Setup

In this chapter, we will create a ROS Workspace and learn how to run publisher and subscriber nodes. First setup workspace using ROS2_WS

Once that is setup, clone our repo inside src folder. $ git clone https://github.com/Achuthankrishna/ROS2_Beginner_Tutorials.git

navigate out to workspace folder and type colcon build on your terminal to build the package.

Finally source your workspace using the command source install/setup.bash

Execution

  • To Run the publisher node,simply type :

    $ ros2 run ros2_beginner_tutorials talker

  • To Run the Subscriber node, open a new terminal window parallely and simply type :

    $ ros2 run ros2_beginner_tutorials listener

Service Call

  • To Run the publisher node,simply type :

    $ ros2 run ros2_beginner_tutorials talker

    To run debug log, run ros2 run cpp_pubsub talker --ros-args --log-level DEBUG

  • To Run the Subscriber node, open a new terminal window parallely and simply type :

    $ ros2 run ros2_beginner_tutorials listener

  • In a 3rd Terminal , source using

    $ source install/ros2_beginner_tutorials/share/ros2_beginner_tutorials/local_setup.bash

    and then run,

    ros2 service call /change_string ros2_beginner_tutorials/srv/ChangeString "{update: 'LIBERTY TO ALL'}"

Launch File

  • To Run the Launch file node,simply type :

    ros2 launch ros2_beginner_tutorials launch.py new_mesg:="I am Iron Ironwiyi"

    where new_mesg is argument that modifies Talker node.

Publish TF Frames

  • Using tf2 echo ros2 run tf2_ros tf2_echo world talker
  • tf2 View Frames ros2 run tf2_tools view_frames

Running Tests

   colcon build --packages-select ros2_beginner_tutorials
  colcon test --packages-select ros2_beginner_tutorials
# with verbose
  colcon test --event-handlers console_direct+ --packages-select ros2_beginner_tutorials

Launch File For ROS Bag

  • To Run the Launch file node,simply type :

    ros2 launch ros2_beginner_tutorials launch_rosbag.py bag_record:="True" new_mesg:="testing ros bag files"

    where new_mesg is argument that modifies Talker node and bag_record records the topics.

    $ source install/ros2_beginner_tutorials/share/ros2_beginner_tutorials/local_setup.bash

    To Run the Subscriber node, open a new terminal window parallely and simply type :

    $ ros2 run ros2_beginner_tutorials listener

    Then play the rosbag file using the code ros2 bag play /src/ROS2_Beginner_Tutorials/Results/Bags/Bags_0.db3

CPP Lint and Check

Go into src and proect directory and type for CPP LINT result

cpplint --filter="-legal/copyright" $( find . -name *.cpp | grep -vE -e "^./build/" )

And the following line for cpp check

cppcheck --enable=all --std=c++11 -I include/ --suppress=missingInclude $( find . -name *.cpp | grep -vE -e "^./build/" )

Outputs

In case if there are dependency errors while building : Since this was done in WSl2 and there might be changes when it comes to linux, please look at the output given here : Demo GIF

Rqt Console

The following is the rqt_console output when launch file launched RQT RQT

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.