Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent handling of tf_prefix #90

Open
saschroeder opened this issue Mar 25, 2020 · 1 comment
Open

Consistent handling of tf_prefix #90

saschroeder opened this issue Mar 25, 2020 · 1 comment

Comments

@saschroeder
Copy link

saschroeder commented Mar 25, 2020

The tf_prefix is not used consistently in the current implementation. The only case, where it is actually resolved is

map_.map.header.frame_id = tf_.resolve( map_frame_ );

so the frame id of the published maps actually includes the prefix, while the transforms of the map frame are published without the prefix:
tfB_->sendTransform( tf::StampedTransform (map_to_odom_, tf_expiration, map_frame_, odom_frame_));

So it's not possible to visualize the resulting map if using tf_prefix.

The two possible solutions are:

  1. don't use the tf_prefix at all
  2. use it consistently (including also the base, scan and odom frame)

If someone knows another solution to use gmapping when the tf_prefix is set, I would appreciate this, too.

@ybgdgh
Copy link

ybgdgh commented Jun 7, 2023

I think you can still use the tf_prefix, but change absolute frame names for all the frames Gmapping needs, such as

    <param name="odom_frame" value="/$(arg robot_name)/odom"/>
    <param name="base_frame" value="/$(arg robot_name)/base_link"/>
    <param name="map_frame" value="/$(arg robot_name)/map"/>

in the main launch file, you can use tf_prefix normally:

  <group ns="/robot_1">
      <param name="tf_prefix" value="robot_1" />
      <include file="$(find jackal_gazebo)/launch/spawn_jackal.launch">
        <arg name="x" value="0" />
        <arg name="y" value="0" />
        <arg name="z" value="0.0" />
        <arg name="yaw" value="0" />
        <arg name="config" value="$(arg config)" />
        <arg name="joystick" value="$(arg joystick)" />
        <arg name="robot_name" value="robot_1"/>
      </include>
      <include file="$(find jackal_navigation)/launch/include/multi_map_move.launch">
        <arg name="robot_name" value="robot_1"/>
      </include> 
  </group>

when you use absolute frame names, you can change anything you want, and don't need to change the source code. Hope this can help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants