Skip to content

Testing a simple chat application with ros talker and listener in cpp

Notifications You must be signed in to change notification settings

jerinpeter/chat_app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple chat Application based on talker and listener node in :::ROS

Introduction

Wrote a simple chat application consisting of 2 nodes in :::ROS, Implementation of basic subscriber-publisher,using the concept of multithreading using AsyncSpinner in ROS.

Prerequisites

Building & Installation


  git clone https://github.com/jerinpeter/ChatApp

  cd .. 

  catkin_make

  rosrun ChatApp speaker

  rosrun ChatApp microphone

Description

Working in brief

  • Uses 2 nodes Speaker and Microphone

  • Both the nodes subscribe and publish to each other

  • Used 2 topics

    • /tomic - for publishing msg from speaker node to microphone node, [subscribed by microhone node]

    • /tospeaker - for publishing msg from microphone node to speaker node, [subscribed by speaker node]

    Rqt_graph

Concept of AsyncSpinner

why ros::spin() is not used?

  • In this package we have 2 nodes, a speaker and a microphone

  • speaker is publishing msgs in the main func inside a while loop and a simple callback function is written to receive messages from the mic

  • All user callbacks will be called from within the ros::spin() call. ros::spin() will not return until the node has been shutdown, either through a call to ros::shutdown() or a Ctrl-C

  • Thus affecting the publishing of the messages from the speaker node in the absense of an Async spinnner

  • The main problem arises in the microphone node where the publishing is executed in the callback func. which maybe delayed as it is waiting for the user i/p.

  • Thus resulting in messegs not getting transmitted from the speaker node or not getting published from the microphone node.

Why AsyncSpinner?

  • The standard ROSCPP spinner (ros::spin()) is single threaded, meaning it will only execute callbacks one by one.

  • On the other hand Async Spinner is a threaded spinner and callbacks will have it's own thread

  • It is ideal in dealing with complicated callback funtions

DEMO

Working

Reference

About

Testing a simple chat application with ros talker and listener in cpp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published