Author: Zuyang Cao
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.
- Ubuntu 16.04 LTS
- ROS-kinetic-full
cd ~/catkin_ws/src
git clone https://github.com/nuclearczy/ROS_beginner_tutorials
cd ..
catkin_make
source devel/setup.bash
In terminal A:
roscore
In terminal B (all the rest part):
roslaunch beginner_tutorials TalkAndListen.launch
You can modify the talker's name when using ROS launch:
roslaunch beginner_tutorials TalkAndListen.launch talker_name:=<name here>
You can modify the message when using ROS launch:
roslaunch beginner_tutorials TalkAndListen.launch message_content:=<message here>
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
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
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
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