upside-down GPS
I'm having a hard time understanding the output of navsat_transform_node. I'm using a robot that is oriented with its up vector pointing down the negative z-axis. So to use the robot in gazebo it is launched upside down. Then to get the HectorGazeboRosIMU working with the proper orientation, it must be inverted using <rpyoffset>180 0 0</rpyoffset>. This causes the robot to appear right-side up in rviz. So far so good.
The problem arises when looking at the output of navsat_transform_node in rviz. When driving in a clockwise circle, its /odometry/gps output traces a counter-clockwise circle. (IMU goes correctly clockwise). In order to get GPS output that I could correctly fuse with robot_localization, and since it only has a yaw_offset but no rpyOffset, I had to write a script that flips it over. Here's the relevant script code:
self.gps_sub = rospy.Subscriber('odometry/gps', Odometry, self.gps_cb)
self.gps_pub = rospy.Publisher('odometry/gps/transformed', Odometry, queue_size=1)
def gps_cb(self, msg):
gps = Odometry()
gps = copy.deepcopy(msg)
gps.pose.pose.position.x = msg.pose.pose.position.y
gps.pose.pose.position.y = msg.pose.pose.position.x
gps.pose.pose.position.z = -msg.pose.pose.position.z
self.gps_pub.publish(gps)
I have sensible localization now, but I don't understand why. Since GPS should be independent of orientation, I don't know why I need to invert it. Also, I wonder if it was correct to do it with a script or if there is some built-in functionality that will do that for me. Can anyone explain all this?