You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to publish a frame, but have not been able to convert it to LocalXy coordinates, this is the python file that I am using currently. Any suggestions would be highly appreciated.
`
#!/usr/bin/env python
import rospy
import tf2_ros
import geometry_msgs.msg
from sensor_msgs.msg import NavSatFix
import swri_transform_util
class NavSatFixTFBroadcaster:
def __init__(self):
rospy.init_node(navsatfix_tf_broadcaster)
self.tf_broadcaster = tf2_ros.TransformBroadcaster()
rospy.Subscriber("/actual", NavSatFix, self.navsatfix_callback)
def navsatfix_callback(self, navsat_fix):
t = geometry_msgs.msg.TransformStamped()
t.header.stamp = rospy.Time.now()
t.header.frame_id = "map"
t.child_frame_id = "dynamic_frame"
# Get latitude and longitude from NavSatFix message
latitude = navsat_fix.latitude
longitude = navsat_fix.longitude
# Calculate the transformation based on latitude and longitude
y = float(longitude)
x = float(latitude)
z = 0.0
print(x,y)
t.transform.translation.x = x
t.transform.translation.y = y
t.transform.translation.z = z
t.transform.rotation.x = 0.0
t.transform.rotation.y = 0.0
t.transform.rotation.z = 0.0
t.transform.rotation.w = 1.0
self.tf_broadcaster.sendTransform(t)
def run(self):
rospy.spin()
if __name__== __main__:
tf_broadcaster = NavSatFixTFBroadcaster()
tf_broadcaster.run()
`
What files and functions will I require to convert the coordinates to LocalXy and vice versa if required? The swri_transform import hasn't been running as well as I though it would.
The text was updated successfully, but these errors were encountered:
It can be configured to take a NavSatFix message and publish the /local_xy_origin topic with the coordinates of a "map" frame origin (or whatever you set that frame to be called).
I've been trying to publish a frame, but have not been able to convert it to LocalXy coordinates, this is the python file that I am using currently. Any suggestions would be highly appreciated.
`
`
What files and functions will I require to convert the coordinates to LocalXy and vice versa if required? The swri_transform import hasn't been running as well as I though it would.
The text was updated successfully, but these errors were encountered: