dummy subscriber for rqt visualization added

This commit is contained in:
Cagdas Aras CIBLAK 2024-03-24 17:54:45 +01:00
parent f4d7dfcc07
commit 698e58c3bc
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
import rospy
from geometry_msgs.msg import Point
def callback(data):
"""Callback function that is called when a message is received on the /trigger topic."""
rospy.loginfo(f"Received point: (x: {data.x}, y: {data.y}, z: {data.z})")
def listener():
"""Sets up the subscriber node."""
# Initialize the node with the name 'point_subscriber'
rospy.init_node('PONG_PADDLES', anonymous=False)
# Subscribe to the '/trigger' topic with the callback function
rospy.Subscriber("/trigger", Point, callback)
# Keep the program alive until it is stopped with Ctrl+C
rospy.spin()
if __name__ == '__main__':
try:
listener()
except rospy.ROSInterruptException:
pass