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

Why while moving backwards the Odometry/gps/Pose/Pose/position/x increasing

asked 2023-06-17 15:14:26 -0500

Dan__2022 gravatar image

updated 2023-06-18 12:39:58 -0500

Hello, I have navsat_transform_node which takes data from GPS and odometry/filtered from ekf_filter_node.

Can't understand, why when my virtual robot moves backwards, the odometry/gps X increased? And when it crosses 0 on X the odometry/gps X instead of being negative becomes some crazy 667955

map->odom is translated as

 map_transform = launch_ros.actions.Node(
        package='tf2_ros',
        executable='static_transform_publisher',
        output='screen',
        arguments = ['--frame-id','map','--child-frame-id', 'odom']
    )

base_link->odom: (msg is subscription to Odometry from /odometry/gps)

self.create_subscription(Odometry, '/odometry/gps', self.__og_sensor_callback, 10)

def __og_sensor_callback(self, msg):
        t = TransformStamped()
        t.header.stamp = self.get_clock().now().to_msg()
        t.header.frame_id = 'base_link'  # here if header is 'odom' and child - 'base_link', in Gazebo 
        t.child_frame_id = 'odom'        #robot moves forward, and in Rviz - backward. strange
        t.transform.translation.x = msg.pose.pose.position.x
        t.transform.translation.y = msg.pose.pose.position.y
        t.transform.translation.z = 0.0
        t.transform.rotation=msg.pose.pose.orientation
        self.tf_broadcaster.sendTransform(t)

ekf config is

        map_frame: map              # Defaults to "map" if unspecified
        odom_frame: odom            # Defaults to "odom" if unspecified
        base_link_frame: base_link  # Defaults to "base_link" if unspecified
        world_frame: odom           # Defaults to the value of odom_frame if unspecified


        odom0: /odometry/gps
        odom0_config: [true, true, false,
                       false, false, false,
                       false, false, false,
                       false, false, false,
                       false, false, false]

        odom0_queue_size: 10
        odom0_nodelay: false
        odom0_differential: false
        odom0_relative: false

        imu0: /demo/imu
        imu0_config: [false, false, false,
                      true,  true,  true,
                      false, false, false,
                      true,  true,  true,
                      true,  true,  true]

        imu0_nodelay: false
        imu0_differential: false
        odom0_relative: false
        imu0_queue_size: 7
        use_control: false

navsat_transform is

navsat_transform:
  ros__parameters:
    use_sim_time: true
    frequency: 30.0
    magnetic_declination_radians: 0.0849975346  # For lat/long  57.452989,  10.021515
    yaw_offset: 1.5707963
    zero_altitude: true
    broadcast_utm_transform: false  
    publish_filtered_gps: true
    use_odometry_yaw: false
    wait_for_datum: false

[EDIT] Tried to mirror base_joint on 180deg in my URDF - no effect robot moves backward, Odometry/gps X coordinate increasing (as well as Y is inverted in the same way)

please, help

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-06-18 13:10:10 -0500

Dan__2022 gravatar image

I found the solution, in the world .sdf file heading_deg should be rotated on 180deg in spherical_coordinates section.

<spherical_coordinates>
      <surface_model>EARTH_WGS84</surface_model>
     ........
      <heading_deg>180</heading_deg>
    </spherical_coordinates>

maybe it should be highlighted in some docs related to GPS in Gazebo.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-06-17 15:14:26 -0500

Seen: 42 times

Last updated: Jun 18 '23