ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

upside-down GPS

asked 2018-09-17 12:33:44 -0500

mogumbo gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-10-27 20:33:40 -0500

123aa gravatar image

The reason why turning it does not work is because fixed links are somehow combined in an optimization step when the urdf is parsed in gazebo. see https://answers.ros.org/question/4473...

and in the merge request of https://github.com/ethz-asl/rotors_si... is it shown.

basic exceprts

<joint name="${namespace}/gps${gps_suffix}_joint" type="revolute">
  <xacro:insert_block name="origin" />
  <parent link="${parent_link}" />
  <child link="${namespace}/gps${gps_suffix}_link" />
  <limit upper="0" lower="0" effort="0" velocity="0" /> <!-- important so it is fixed kind of -->
</joint>

also you have to add it to your publisher to still see the tf, e.g.

your_joint_publisher:
type: joint_state_controller/JointStateController
publish_rate: 100
extra_joints:
  - name: gps_suffix

if this is not enough, you can add something like

<referenceHeading>90.0</referenceHeading>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-09-17 12:33:44 -0500

Seen: 398 times

Last updated: Oct 27 '18