From 698e58c3bcb12c4dd443e67830b648cdcfa57545 Mon Sep 17 00:00:00 2001 From: "cagdas-aras.ciblak" Date: Sun, 24 Mar 2024 17:54:45 +0100 Subject: [PATCH] dummy subscriber for rqt visualization added --- catkin_ws/src/ball_tracking/src/dummy_sub.py | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 catkin_ws/src/ball_tracking/src/dummy_sub.py diff --git a/catkin_ws/src/ball_tracking/src/dummy_sub.py b/catkin_ws/src/ball_tracking/src/dummy_sub.py new file mode 100755 index 0000000..6b6bcf2 --- /dev/null +++ b/catkin_ws/src/ball_tracking/src/dummy_sub.py @@ -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 +