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

ekf_localization_node publishes /odom->husky_1/base_link transform instead of husky_1/odom->/husky_1/base_link transform

asked 2021-02-04 04:51:49 -0500

updated 2021-02-21 06:39:27 -0500

I have an arg named husky_ns defined in my launch file. I have set it to husky_1.

Using the ekf_localization_node (from the robot_localization package), I want to publish the husky_1/odom to /husky_1/base_link transform on the tf tree.

I have tried the following variations inside my launch file to achieve the same -

Variation One

 <node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization" ns="$(arg husky_ns)">


        <rosparam command="load" file="$(find bot_mapper)/config/localization.yaml" subst_value="true" />

    </node>

This variation produces /odom to /base_link transform on the tf tree.

Variation Two

 <node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization" >

        <param name="tf_prefix" value="$(arg husky_ns)" />
        <rosparam command="load" file="$(find bot_mapper)/config/localization.yaml" subst_value="true" />

    </node>

This variation does not add any new transform to the tf tree.


This is how my localization.yaml file looks -

odom_frame: odom
base_link_frame: base_link
world_frame: odom

two_d_mode: true

frequency: 50

odom0: husky_velocity_controller/odom
odom0_config: [false, false, false,
               false, false, false,
               true, true, true,
               false, false, true,
               false, false, false]
odom0_differential: false
odom0_queue_size: 10

imu0: imu/data
imu0_config: [false, false, false,
              true, true, true,
              false, false, false,
              true, true, true,
              false, false, false]
imu0_differential: true
imu0_queue_size: 10
imu0_remove_gravitational_acceleration: true
edit retag flag offensive close merge delete

Comments

1

FYI tf_prefix does not look to be a parameter in robot_localization so idk what that is doing in your "second" config.

JackB gravatar image JackB  ( 2021-02-04 08:11:39 -0500 )edit

I don't know if this will translate to the tf tree, but in general if you have a husky_1 and husky_2 you should be using the group tag with the "ns" attribute to separate the nodes/topics/parameters between the two

JackB gravatar image JackB  ( 2021-02-04 08:13:57 -0500 )edit

@JackB There was a typo in my variation one. I have updated variation one. (I had missed to add ns=$(arg husky_ns) )

So, the bottom line is when I include the ns="$(arg husky_ns)" in the node tag, ekf_localization_node does prodcue a transform, but from /odom to /base_link. When I do not include ns=$(arg husky_ns), no transform is published by the ekf_localization_node.

When I modify the base_link_frameparam in localization.yaml from base_link to $(arg husky_ns)/base_link (in variation one), I get this constant warning in my terminal and no transform is published on the tf tree -

Could not obtain transform from base_link to husky_1/base_link. Error was "base_link" passed to lookupTransform argument source_frame does not exist.
skpro19 gravatar image skpro19  ( 2021-02-04 10:10:34 -0500 )edit

@JackB how did you figure out whether tf_prefix is a paramter in ekf_localization_node?

skpro19 gravatar image skpro19  ( 2021-02-04 10:28:08 -0500 )edit
1

Look at the docs robot_localization, they are all listed therer

JackB gravatar image JackB  ( 2021-02-04 10:34:18 -0500 )edit

I am not sure if I understrand your problem however are you trying to remap it ? if yes you can use the following code in your launch file

<remap from="odometry/filtered" to=""/> <remap from="accel/filtered" to=""/>

in addtion, after you launch your nodes you can use "rosrun rqt_tf_tree rqt_tf_tree" in order to generate the trees and see if the relations are correct or not

AmirSaman gravatar image AmirSaman  ( 2021-02-04 12:49:24 -0500 )edit

I am trying to make ekf_localization_node publish huky_1/odom -> /husky_1/base_link transform. It currently publishes a transform from /odom -> /base_link.

Does that make sense?

skpro19 gravatar image skpro19  ( 2021-02-05 09:29:07 -0500 )edit

@JackB I did manage to make the ekf_localization_node publish the /husky_1/odom -> /husky_1/base_link transform. How do I make sure that the transform being published by the ekf_localization_node is correct i.e. the bot is being localized correctly?

skpro19 gravatar image skpro19  ( 2021-02-09 08:43:01 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-02-21 06:30:35 -0500

updated 2021-02-21 06:33:29 -0500

I did manage to solve the above issue using this answer.

I would briefly sum it up here -

ekf_localization_node subscribes to the topics - /husky_velocity_controller/odom and /imu/data. We need to make some small changes in the way these two topics are being published.

For imu, we need to add a <frameId> tag inside the husky.urdf.xacro file.

<frameId>$(arg husky_ns)/base_link</frameId>

For odom, we need to modify the base_frame_id parameter inside the control.yaml file being used by base_controller_spawner node.

base_frame_id: $(arg husky_ns)/base_link
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-02-04 04:51:49 -0500

Seen: 349 times

Last updated: Feb 21 '21