본문 바로가기

ROS

[ROS Programming] Making Basic Nodes with Python

< Publisher & Subscriber를 python으로 작성>

 

참고 동영상)  https://youtu.be/izfXL3rIt10

 

$ mkdir -p catkin_ws/src

$ cd src

$ catkin_create_pkg node_basic std_msgs geometry_msgs rospy

$ cd node_basic

$ mkdir scripts

 

publisher.py

 

subscriber.py

$ catkin_make

$ roscore

$ rosrun node_basic pulblisher.py

$ rosrun node_basic subscriber.py

 

 

참고) https://hagler.tistory.com/155

 

(8) motor_control 노드 작성

motor_control 노드 #!/usr/bin/env python # license removed for brevity import rospy from std_msgs.msg import UInt16MultiArray pub = rospy.Publisher('cmd_vel',UInt16MultiArray,queue_size=10) cmd_vel..

hagler.tistory.com

*배열을 publisher 하고 Subscriber 하는 방식을 추가 검토

UInt16 -> UInt16MultiArray 로 변경하고

cmd.msg.data[0] <-  이런식으로 배열에 접근