4 from geometry_msgs.msg
import Polygon, Point32, PolygonStamped
5 from std_msgs.msg
import Float32
6 from threading
import Lock
10 pending_polygon =
None 17 rospy.logdebug(
"scale is 0!, we skip it")
19 width_scale = msg.data
26 rospy.logdebug(
"scale is 0!, we skip it")
28 height_scale = msg.data
32 global pending_polygon
34 if width_scale
and height_scale:
40 global pending_polygon, width_scale, height_scale
41 if (pending_polygon
and width_scale
and height_scale
42 and width_scale != 0
and height_scale != 0):
44 pending_polygon =
None 47 global width_scale, height_scale, inverse, pub
49 Rw = 1.0 / width_scale
50 Rh = 1.0 / height_scale
54 for point
in poly_msg.polygon.points:
55 point.x = Rw * point.x
56 point.y = Rh * point.y
59 rospy.init_node(
"scale_interaction")
61 inverse = rospy.get_param(
"~inverse",
False)
62 pub = rospy.Publisher(
"~output", PolygonStamped)
63 sub_polygon = rospy.Subscriber(
"~input", PolygonStamped, polygonCallback)
64 sub_width = rospy.Subscriber(
"~input/width_scale", Float32, widthScallCallback)
65 sub_height = rospy.Subscriber(
"~input/height_scale", Float32, heightScallCallback)
def widthScallCallback(msg)
def publishResizedPolygon(poly_msg)
def heightScallCallback(msg)
def updateForPendingData()