Add subscriber example

This commit is contained in:
Oleg Kalachev
2021-09-24 17:34:54 +03:00
parent 77832e65fa
commit 613f70fd25

View File

@@ -0,0 +1,15 @@
# Information: https://clover.coex.tech/en/laser.html
import rospy
from sensor_msgs.msg import Range
rospy.init_node('process_rangefinder')
def range_callback(msg):
# Process data from the rangefinder
print('Rangefinder distance:', msg.range)
# Subscribe to laser rangefinder data
rospy.Subscriber('rangefinder/range', Range, range_callback)
rospy.spin()