ROS VERSION: Melodic OS VERSION: Ubuntu 18.04 package tf version: 1.12.1
I'm trying to create a node that processes a PolygonStamped object and transform each point of it to a especified frame_id in order to calculate prohibited regions.
I'm publishing for this example the tf from utm to map as a traslation 5,5,0 (x,y,z) and no rotation.
Here is the fragment where I try to set up the transformation process:
for zone in zones_dict:
obj = PolygonStamped()
obj.header.stamp = rospy.get_time()
obj.header.frame_id = 'utm'
obj.header.frame_id = zones_dict[zone]['frame_id']
for point in zones_dict[zone]['points']:
point_stamped = PointStamped()
point_stamped.header.frame_id = str(zones_dict[zone]['frame_id'])
point_stamped.header.stamp = rospy.Time.now()
point_stamped.point.x = point[0]
point_stamped.point.y = point[1]
point_stamped.point.z = point[2]
print(point_stamped)
point_transformed = self.tf_listener.transformPoint(str(obj.header.frame_id), point_stamped)
print(point_transformed)
point_formatted = Point32()
point_formatted.x = point_transformed.point.x
point_formatted.y = point_transformed.point.y
point_formatted.z = point_transformed.point.z
obj.polygon.points.append(point_formatted)
Variable point_stamped
header:
seq: 0
stamp:
secs: 1706527825
nsecs: 68283081
frame_id: "map"
point:
x: 0.0
y: 0.0
z: 0.0
Variable point_transformed
header:
seq: 0
stamp:
secs: 1706527825
nsecs: 68283081
frame_id: "map"
point:
x: 0.0
y: 0.0
z: 0.0
Supposed behaviour (point_transformed)
header:
seq: 0
stamp:
secs: 1706527825
nsecs: 68283081
frame_id: "utm"
point:
x: 5.0
y: 5.0
z: 0.0
Why the function transformPoint returns me the same point_stamped? Also I'm not aware of the state of tf2 in this version, since I have worked with Noetic, but should I use tf2 even in this outdated distribution of ROS?