Giter Site home page Giter Site logo

rajpshinde / beginner_tutorials Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.17 MB

This is beginners tutorial for creating a simple ROS package called begineers_tutorials with a Publisher & Subscriber node

License: MIT License

CMake 12.65% C++ 87.35%
ros tutorial publish-subscribe service robotics rosbag

beginner_tutorials's Introduction

beginner_tutorials

License MIT Docs Generated

Authors

Raj Prakash Shinde - GitHub
I am a Masters in Robotics Engineering student at the University of Maryland, College Park. My primary area of interest are Legged Robotics and Automation.

Overview

This is beginners tutorial for creating a simple ROS package called begineers_tutorials with a Publisher & Subscriber node. Where a publisher named talker, publishes a message and the subscriber called, listener hears the message. The message type here is a string. A talker node has a service that can be used to change the message content. A launch file can be used to launch both the nodes, which also passes the loop rate as an argument.

Dependencies

  1. Ubuntu 16.04
  2. ROS Kinetic

Build

Steps to build

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
source devel/setup.bash
cd src/
git clone https://github.com/RajPShinde/beginner_tutorials
cd ~/catkin_ws/
catkin_make

Run

  1. Launch both nodes Individually Run roscore (Open a Terminal)
cd ~/catkin_ws/
source ./devel/setup.bash
roscore

Run talker node (Open a new Terminal)

cd ~/catkin_ws/
source ./devel/setup.bash
rosrun beginner_tutorials talker 10

Run listener node (Open a new Terminal)

cd ~/catkin_ws/
source ./devel/setup.bash
rosrun beginner_tutorials listener
  1. Launch both nodes with the launchfile (Open a new Terminal)
cd ~/catkin_ws/
source ./devel/setup.bash
roslaunch beginner_tutorials nodelauncher.launch

You can change the frequency by passing an argumnet, default is 10 (Open a new Terminal)

cd ~/catkin_ws/
source ./devel/setup.bash
roslaunch beginner_tutorials nodelauncher.launch rate:=8
  1. Run service to change string launch both nodes and then Open a new Terminal
cd ~/catkin_ws/
source ./devel/setup.bash
rosservice call /service_string "Enter new string"
  1. To view Log levels using rqt console and rqt logger level Open a new Terminal
rosrun rqt_console rqt_console

Open a new Terminal

rosrun rqt_logger_level rqt_logger_level
  1. Inspecting TF Frames After launching both nodes using launch file, we can inspect the TF frames using tf_echo and rqt_tf_tree (Open a new Terminal)
rosrun tf tf_echo /world /talk

To genereate a pdf of tf frame

rosrun tf view_frames

Open a new Terminal

rosrun rqt_tf_tree rqt_tf_tree
  1. Run Test Open a new Terminal
cd ~/catkin_ws
source ./devel/setup.bash
catkin_make run_tests_beginner_tutorials
rostest beginner_tutorials testlauncher.launch
  1. Record in Rosbag To record in a rosbag, pass a true argument to the launch file(Open a new Terminal)
roslaunch beginner_tutorials nodelauncher.launch recordbag:=true

To avoid recording, either pass false or don't pass any argument

roslaunch beginner_tutorials nodelauncher.launch recordbag:=false

OR

roslaunch beginner_tutorials nodelauncher.launch
  1. Use Rosbag First launch the listener node and then Open a new Terminal and play rosbag
cd ~/catkin_ws/src/beginner_tutorials/results
rosbag play recording.bag

You can see that the listener node can hear the rosbag data of previously recorded talker node.

Reference

beginner_tutorials's People

Contributors

rajpshinde avatar

Watchers

 avatar

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.