/ROS_beginner_tutorials

Primary LanguageC++BSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

ROS_beginner_tutorials

Build Status GitHub

Author: Zuyang Cao

Overview

A simple publisher and subscriber tutorial on ROS. The publisher node can take input from launch file and the subscriber has a service to change the listener status.

Dependencies and Environments

  • Ubuntu 16.04 LTS
  • ROS-kinetic-full

Installation Steps

cd ~/catkin_ws/src
git clone https://github.com/nuclearczy/ROS_beginner_tutorials
cd ..
catkin_make
source devel/setup.bash

Run the Code

In terminal A:

roscore

In terminal B (all the rest part):

roslaunch beginner_tutorials TalkAndListen.launch

Modify Talker's Name

You can modify the talker's name when using ROS launch:

roslaunch beginner_tutorials TalkAndListen.launch talker_name:=<name here>

Modify Message

You can modify the message when using ROS launch:

roslaunch beginner_tutorials TalkAndListen.launch message_content:=<message here>

Calling ROS Service

After launched the listener_node, a toggle_listen_status service can be called to change the listener_node working status:

rosservice call /toggle_listen_status

TF Frames

Run commands in separate terminals:

rosrun beginner_tutorials talker

Inspect tf frames:

rosrun tf tf_echo /world /talk

To inspect the visualized graph:

rosrun rqt_tf_tree rqt_tf_tree 

To save graph as pdf:

rosrun tf view_frames

ROSTest

First run the talker node:

rosrun beginner_tutorials talker

To compile and run the tests:

catkin_make run_tests_beginner_tutorials

After complie completes, run:

rostest beginner_tutorials test.launch

or

rosrun beginner_tutorials test_talker 

ROS Bag

Use ROS bag to record topics info:

roslaunch beginner_tutorials TalkAndListen.launch record:=enable

To inspect recorded ROS bag info:

rosbag info talker.bag

To replay the recorded ROS bag, first run listener node:

rosrun beginner_tutorials listener

Then start the replay:

rosbag play talker.bag