6 from view_controller_msgs.msg
import CameraPlacement
7 from geometry_msgs.msg
import PointStamped
8 from jsk_gui_msgs.msg
import Tablet
9 from threading
import Lock
12 latest_mouse_point =
None 15 global latest_mouse_point
17 latest_mouse_point = msg
20 global latest_mouse_point
24 if not latest_mouse_point:
26 next_x = latest_mouse_point.point.x * 640
27 next_y = latest_mouse_point.point.y * 480
29 msg.header.stamp = rospy.Time.now()
30 msg.action.task_name =
"MoveCameraCenter" 32 msg.action.touch_x = next_x
33 msg.action.touch_y = next_y
34 rospy.loginfo(
"neck actino to (%f, %f)" % (msg.action.touch_x, msg.action.touch_y))
36 latest_mouse_point =
None 39 if __name__ ==
"__main__":
40 rospy.init_node(
"rviz_mouse_point_to_tablet")
41 pub = rospy.Publisher(
"/Tablet/Command", Tablet)
42 sub = rospy.Subscriber(
"/rviz/current_mouse_point",
43 PointStamped, pointCallback)
44 rospy.Timer(rospy.Duration(0.3), timerCallback)