This is ROS basic Tutorial with python
I referenced this book http://www.yes24.com/24/goods/37617833
Here, most code is in https://github.com/Jpub/ROS because I referenced it
Before You start, Please ready for below operation
- Have labtop with Ubuntu 16.04(LTS) and installed ROS Kinetic
$ mkdir catkin_ws && cd src
First, make workspace in catkin_ws
$ catkin_create_pkg Tutorial rospy std_msgs
Second, make Tutorial package with depend package rospy, std_msgs
$ cd Tutorial/script
$ chmod u+x publish_node.py subscribe_node.py
Third, change permit publish_node.py and subscriber_node.py
$ cd catkin_ws && catkin_make
$ rospack profile
$ roscore
$ rosrun Tutorial publish_node.py (another terminal)
$ rosrun Tutorial subscribe_node.py (another terminal)
Add complex message 'Complex.msg' containing
float32 real
float32 imaginary
in msg directory
Change package.xml
<build_depend>message_generation</build_depend>
<exec_depend>message_runtime</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>std_msgs</exec_depend>
and CMakeList.txt
find_package(catkin REQUIRED COMPONENTS
rospy
std_msgs
message_generation
)
catkin_package(
CATKIN_DEPENDS message_runtime
...(something else)
)
add_message_files(
FILES
Complex.msg
)
generate_message(
DEPENDENCIES
std_msgs
)
Then you can generate it like 1Day
Before you build catkin_package, make sure that make 'include' directory in 'Tutorial' directory
Publisher is 'complex_pub.py'
Subscriber is 'complex_sub.py'