USE GPS for ROS

为什么还需要odom(编码器)和IMU:

  1. odom用来减少误差
  2. IMU用来提供角度
    在这里插入图片描述

建立一个空白地图

为什么:因为导航包(robot_localization)需要
yaml地图参数

image:  mymap_empty.pgm
resolution: 0.050000
origin: [-50.000000, -50.000000, 0.000000]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196

launch载入地图

<launch>
    <arg name="map_file" default="$(find gps_navigation)/maps/mymap_empty.yaml"/>
    <node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />
</launch>

把GPS数据转换成odom

(Convert GPS data into Odometry data)
use the navsat_transform_node ROS node provided by the robot_localization package.

<launch>
 <!-- -->
  <node pkg="robot_localization" type="navsat_transform_node" name="navsat_transform_node" respawn="true">

    <param name="magnetic_declination_radians" value="0"/>
    <param name="yaw_offset" value="0"/>
    <param name="zero_altitude" value="true"/>
    
    
    <param name="broadcast_utm_transform" value="false"/>
    <param name="publish_filtered_gps" value="false"/>

    
    <param name="use_odometry_yaw" value="false"/>
    <param name="wait_for_datum" value="false"/>
    

    <remap from="/imu/data" to="/imu/data" />
    <remap from="/gps/fix" to="/gps/fix" />
    <remap from="/odometry/filtered" to="/odom" />

  </node>

</launch>
  • magnetic_declination_radians: This parameter is needed if your IMU provides its orientation with respect to the magnetic north. It states the magnetic declination for your location (the difference between the magnetic north and the true north). If you don’t know it, you can calculate it here http://www.ngdc.noaa.gov/geomag-web (make sure to convert the value to radians).

  • yaw_offset: Your IMU should read 0 for yaw when facing east. If it doesn’t, enter the offset here (desired_value = offset + sensor_raw_value)

  • zero_altitude: If this is set to true, the Odometry message produced by this node has its pose Z value set to 0.

  • broadcast_utm_transform: This is in case you want to publish the static TF of the UTM (Origin of the GPS system) in the TF tree.

  • publish_filtered_gps: No mystery here, if you want it to publish improved odometry and IMU GPS data. If it’s set to true, the navsat_transform_node will publish a sensor_msgs/NavSatFix message on the /gps/filtered topic.

  • use_odometry_yaw: This is for when you have a very reliable odometry turning system. In the case of robots outdoors, the turning data in odometry is reliable enough because they skid only once in a while, especially on rough terrain. That’s why it’s turned OFF here.

  • wait_for_datum: This is to give the system the datum directly, what is considered the origin of our GPS localization. Normally, it’s the GPS that directly gives this data and that’s why it’s normaly turned off. If you need to give it for some reason, you will have to add the following param setting into this launch:

<rosparam param="datum">[55.944904, -3.186693, 0.0, map, base_link]</rosparam>

remap:后者是实际的,前者是需要的 (把实际改成需要的) 把什么变成什么

把当前话题里面的名字换成其他的

fuse(融合)

We use the ekf_localization_node from the robot_localization package to fuse the data of the robot odometry, robot IMU and GPS odometry generated with the navsat_transform.
launch

<launch>
    <!-- Run the ekf for map to odom config -->
    <node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization_with_gps"> 
        <rosparam command="load" file="$(find gps_navigation)/config/gps_localization_config.yaml" />
    </node>
</launch>

yaml

#Configuation for robot odometry EKF
#
frequency: 50

two_d_mode: true

publish_tf: true

odom_frame: odom
base_link_frame: base_footprint
world_frame: map
map_frame: map

odom0: /odom
odom0_config: [false, false, false,
               false, false, false,
               true, true, false,
               false, false, true,
               false, false, false]
odom0_differential: true

imu0: /imu/data
imu0_config: [false, false, false,
              false, false, true,
              false, false, false,
              false, false, true,
              true, false, false]
imu0_differential: false

odom1: /odometry/gps
odom1_config: [false, false, false,
               false, false, false,
               true, true, false,
               false, false, true,
               false, false, false]
odom1_differential: false

process_noise_covariance: [0.05, 0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0.05, 0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0.06, 0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0.03, 0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0.03, 0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0.06, 0,     0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0.025, 0,     0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0.025, 0,    0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0.04, 0,    0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0.01, 0,    0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0.01, 0,    0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0.02, 0,    0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0.01, 0,    0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0.01, 0,
                                              0,    0,    0,    0,    0,    0,    0,     0,     0,    0,    0,    0,    0,    0,    0.015]


initial_estimate_covariance: [1e-9, 0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    1e-9, 0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    1e-9, 0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    1e-9, 0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    1e-9, 0,    0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    1e-9, 0,    0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    1e-9, 0,    0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    1e-9, 0,    0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    1e-9, 0,     0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    0,    1e-9,  0,     0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     1e-9,  0,     0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     1e-9,  0,    0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     1e-9, 0,    0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    1e-9, 0,
                                                      0,    0,    0,    0,    0,    0,    0,    0,    0,    0,     0,     0,     0,    0,    1e-9]


一起launch

launch

<launch>

    <include file="$(find gps_navigation)/launch/start_navsat.launch" />

    <!-- Run the ekf for map to odom config -->
    <include file="$(find gps_navigation)/launch/ekf_localization.launch" />

    <!-- Run the map server -->
    <include file="$(find gps_navigation)/launch/start_map_server.launch" />

    <!--- Run Move Base -->
    <include file="$(find my_move_base)/launch/my_move_base.launch" />

</launch>
  • 0
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值