ekf_localization_node publishes /odom->husky_1/base_link transform instead of husky_1/odom->/husky_1/base_link transform
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
Asked by skpro19 on 2021-02-04 05:51:49 UTC
Answers
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
Asked by skpro19 on 2021-02-21 07:30:35 UTC
Comments
FYI tf_prefix does not look to be a parameter in robot_localization so idk what that is doing in your "second" config.
Asked by JackB on 2021-02-04 09:11:39 UTC
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
Asked by JackB on 2021-02-04 09:13:57 UTC
@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 includens=$(arg husky_ns)
, no transform is published by theekf_localization_node
.When I modify the
base_link_frame
param
inlocalization.yaml
frombase_link
to$(arg husky_ns)/base_link
(in variation one), I get this constant warning in my terminal and no transform is published on thetf
tree -Asked by skpro19 on 2021-02-04 11:10:34 UTC
@JackB how did you figure out whether
tf_prefix
is a paramter inekf_localization_node
?Asked by skpro19 on 2021-02-04 11:28:08 UTC
Look at the docs robot_localization, they are all listed therer
Asked by JackB on 2021-02-04 11:34:18 UTC
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
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
Asked by AmirSaman on 2021-02-04 13:49:24 UTC
I am trying to make
ekf_localization_node
publishhuky_1/odom -> /husky_1/base_link
transform. It currently publishes a transform from/odom -> /base_link
.Does that make sense?
Asked by skpro19 on 2021-02-05 10:29:07 UTC
@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 theekf_localization_node
is correct i.e. the bot is being localized correctly?Asked by skpro19 on 2021-02-09 09:43:01 UTC
Can you visually inspect it by observing the motion of the frames in RVIZ?
Asked by JackB on 2021-02-09 10:05:48 UTC
@JackB could you please elaborate on the above point? You want me to add
tf_frames
in theRviz
display? How would that help?Asked by skpro19 on 2021-02-21 07:13:00 UTC