/asmarine_pkg

a simple example of a topic message communication between two nodes using c++ and python

Primary LanguageMakefile

asmarine_pkg

This repository contains code necessary to make a ROS topic message communication between two nodes (publisher and subscriber node) using c++ and python, For every 5 counts every 10 sec in the publisher node, It should publish a message to the subscriber node and change its state.

Prerequisites:

To run the program, you need to have the following installed :

Getting Started

add the package in your catkin_ws

$ cd ~/catkin_ws/src

$ git clone https://github.com/hosniadel666/asmarine_pkg.git

Now to run the program using c++

first build the package source files and run roscore

$ cd asmarine_pkg/build

$ cmake ..

$ make

$ roscore

second we run the two nodes

$ ./talker

and in another terminal run

$ ./listener

Now to run the program using python

$ roscore

$ rosrun asmarine_pkg talker.py

and in another terminal run

$ rosrun asmarine_pkg listener.py

Result

  • the execution of the program should be like that :

  • You can visualize the relation between nodes By using the rqt_graph ROS plugin to visualize the ROS computation graph
$ rosrun rqt_graph rqt_graph