0
$\begingroup$

I use ROS2/Python/Gazebo project. In online examples, I see robot_localization node using (usually in nav2_params.yaml) the "imu/data" as imu source. In the same time, all projects I got from the Internet, produce "imu" (no "data" part). Are these two the same? And how to "explain" it to robot_localization node:

    robot_localization_node = Node(
        package='robot_localization',
        executable='ekf_node',
        name='ekf_filter_node',
        namespace=namespace,
        output='screen',
        parameters=[ 
            os.path.join(def_bringup_dir, 'config', 'nav2_params.yaml'),
            {'use_sim_time': use_sim_time }],
        #remappings=[('odometry/filtered', 'odometry/filtered_no_gps'),
        #    ('/set_pose', '/initialpose')
        #]
    )  

So far, it doesn't publish odometry/filtered AT ALL. Plus, I cannot figure out what the commented out remappings are for.

Please help.

amcl: ros__parameters: set_initial_pose: true initial_pose: x: robot_pos_x y: robot_pos_y z: 0.1 yaw: 0.0

use_sim_time: True
alpha1: 0.002
alpha2: 0.002
alpha3: 0.002
alpha4: 0.002
alpha5: 0.002 
base_frame_id: "base_footprint"
odom_frame_id: "odom"
scan_topic: /scan
beam_skip_distance: 0.5
beam_skip_error_threshold: 0.9
beam_skip_threshold: 0.3
do_beamskip: false
global_frame_id: "map"
lambda_short: 0.1
laser_likelihood_max_dist: 2.0
laser_max_range: 100.0
laser_min_range: -1.0
laser_model_type: "likelihood_field"
map_frame: map
max_beams: 60
max_particles: 2000
min_particles: 500
pf_err: 0.05
pf_z: 0.99
recovery_alpha_fast: 0.0
recovery_alpha_slow: 0.0
resample_interval: 1
robot_model_type: "differential"
save_pose_rate: 0.5
sigma_hit: 0.2
tf_broadcast: true
transform_tolerance: 1.0
update_min_a: 0.2
update_min_d: 0.25
z_hit: 0.5
z_max: 0.05
z_rand: 0.5
z_short: 0.05

amcl_map_client: ros__parameters: use_sim_time: True

amcl_rclcpp_node: ros__parameters: use_sim_time: True

...

ekf_filter_node: ros__parameters:

    use_sim_time: true
    frequency: 30.0
    sensor_timeout: 0.1
    two_d_mode: true
    transform_time_offset: 0.0
    transform_timeout: 0.0
    print_diagnostics: true
    debug: false
    debug_out_file: /path/to/debug/file.txt
    publish_tf: true
    publish_acceleration: false
    reset_on_time_jump: true
    map_frame: map                   # Defaults to "map" if unspecified
    odom_frame: odom                 # Defaults to "odom" if unspecified
    base_link_frame: base_footprint  # Defaults to "base_link" if unspecified
    world_frame: odom                 # Defaults to the value of odom_frame if unspecified
    odom0: /odom
    odom0_config: [true, true, true,
                   false, false, false,
                   true,  true,  true,
                   false, false, true,
                   false, false, false]
    odom0_queue_size: 2
    odom0_nodelay: false
    odom0_differential: false
    odom0_relative: false
    odom0_pose_rejection_threshold: 5.0
    odom0_twist_rejection_threshold: 1.0

    imu0: /imu
    imu0_config: [false, false, false,
                  true,  true,  true,
                  false, false, false,
                  true,  true,  true,
                  true,  true,  true]
    imu0_nodelay: false
    imu0_differential: false
    imu0_relative: true
    imu0_queue_size: 7
    imu0_pose_rejection_threshold: 0.8                 # Note the difference in parameter names
    imu0_twist_rejection_threshold: 0.8                #
    imu0_linear_acceleration_rejection_threshold: 0.8  #
    imu0_remove_gravitational_acceleration: true
    use_control: false
    stamped_control: false
    control_timeout: 0.2
    control_config: [true, false, false, false, false, true]
    acceleration_limits: [1.3, 0.0, 0.0, 0.0, 0.0, 3.4]
    deceleration_limits: [1.3, 0.0, 0.0, 0.0, 0.0, 4.5]
    acceleration_gains: [0.8, 0.0, 0.0, 0.0, 0.0, 0.9]
    deceleration_gains: [1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
    process_noise_covariance: [0.05,   0.0,    ..

    initial_estimate_covariance: [1e-9,   0.0,    ...

# navsat_transform:
#   ros__parameters:
#     use_sim_time: true
#     frequency: 10.0
#     delay: 3.0
#     magnetic_declination_radians: 0.093084220955  # For lat/long of Atlanta, Georgia
#     yaw_offset: 0.0  # if IMU reads 0 when facing magnetic north instead of east then set parameter to pi/2
#     zero_altitude: true
#     broadcast_utm_transform: true
#     broadcast_utm_transform_as_parent_frame: true
#     publish_filtered_gps: true
#     use_odometry_yaw: false
#     wait_for_datum: true
    
$\endgroup$

1 Answer 1

3
$\begingroup$

The message type is the same - it's just a different topic name/namespace. For a robot that only has a single topic carrying IMU data, "imu" might be sufficient. However, many robots end up having a whole IMU data pipeline - for instance, you might often find several different topics all namespaced under "imu":

  • imu/data - this might be the raw data coming out of the sensor.
  • imu/filtered - there might be a node that subscribes to imu/data, filters the data, and then publishes the new filtered data to imu/filtered.

As for the remappings - when someone wrote the "robot_localization" node, they set it up to publish to a topic called "odometry/filtered". Remapping then allows the node to publish to "odometry/filtered_no_gps" without recompiling the code with a new topic name. You might be interested to look at the remapping design doc for ROS 2.

As for data not coming out of the node - we'd need to look into your nav2_params.yaml because that is going to define some parameters, including the names of the topics the node is subscribing.

$\endgroup$
1
  • $\begingroup$ Thank you. I have added ekf config to original message. Please note that I do not use GPS: I have it in my system, but I do not want it to be merged with other sensors. So I didn't include it to yaml file. $\endgroup$ Sep 18 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.