我的小车使用ros1,小车的驱动涉及两个launch文件,第一个文件bring_test.launch文件内容如下:

<launch>
<group ns="r1">
  <!--serial communication between arduino and pc via usb /-->
  <node name="arduino_serial_node" pkg="rosserial_python" type="serial_node.py" output="screen">
    <param name="port" value="/dev/xrbase" />
    <param name="baud" value="115200" />
    <remap from="cmd_vel" to="cmd_vel" />
  </node>
 
   <!-- IMU Relay and Filter -->
     <!-- IMU relay from rikirobot_msgs/Imu to sensor_msgs/Imu -->
    <node pkg="imu_calib" type="apply_calib" name="apply_calib" output="screen" respawn="false">
        <param name="calib_file" value="$(find xrrobot)/param/imu/imu_calib.yaml" />
        <param name="calibrate_gyros" value="true" />
    </node>
 
    <!-- Filter and fuse raw imu data -->
    <node pkg="imu_filter_madgwick" type="imu_filter_node" name="imu_filter_madgwick" output="screen" respawn="false" >
        <param name="fixed_frame" value="base_footprint" />
        <param name="use_mag" value="fasle" />
        <param name="publish_tf" value="false" />
        <param name="use_magnetic_field_msg" value="fasle" />
        <param name="world_frame" value="enu" />
        <param name="orientation_stddev" value="0.05" />
        <param name="angular_scale" value="1.03" />
    </node>
 
 
    <!-- Publish static transform from base_footprint to imu_link -->
    <node pkg="tf" type="static_transform_publisher" name="base_footprint_to_imu_link" args="0 0 0 0 0 0  /base_footprint /imu_link  100"/>
 
 
    <!-- Publish Linorobot odometry -->
    <node pkg="xrrobot" name="riki_base_node" type="riki_base_node">
    	<param name="linear_scale" type="double" value="0.63" />
    </node>
 
    <!-- Publish static transform from base_footprint to base_link -->
    <node pkg="tf" type="static_transform_publisher" name="base_footprint_to_base_link" args="0 0 0.098 0 0 0  /base_footprint /base_link  100"/>
 
    <!-- Odom-IMU Extended Kalman Filter-->
    <node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization">
        <remap from="odometry/filtered" to="odom" />
        <rosparam command="load" file="$(find xrrobot)/param/ekf/robot_localization.yaml" />
    </node>
</group>
</launch>

第二个launch文件navigate_test.launch文件的内容如下:

<launch>
 
<group ns="r1">
  <!--雷达驱动 launch文件替换-->
  <!-- <include file="$(find xrrobot)/launch/lidar/$(env XRLIDAR).launch" /> -->
  <node pkg="sc_mini" type="sc_mini" name="sc_mini" output="screen">
    <param name="frame_id" type="string" value="laser"/>
    <param name="port" type="string" value="/dev/xrlidar"/>
    <param name="baud_rate" type="int" value="115200"/>
	  <param name="inverted"        type="bool"   value="false"/>
    <param name="angle_compensate"    type="bool"   value="true"/>
  </node>
 <node pkg="tf" type="static_transform_publisher" name="base_link_to_laser" args="0.04 0 0.18 0 0 0  /base_link /laser  100"/>
 
 
  <!--地图配置文件加载-->
  <arg name="map_file" default="$(find xrrobot)/maps/house.yaml"/>
  <node pkg="map_server" name="map_server"  type="map_server" args="$(arg map_file)" />
 
  <!--定位文件amcl,launch文件替换-->
  <!-- <include file="$(find xrrobot)/launch/amcl_test.launch" /> -->
  <node pkg="amcl" type="amcl" name="amcl" output="screen">
        <param name="base_frame_id" value="base_footprint"/> <!-- Change this if you want to change your base frame id. -->
        <param name="gui_publish_rate" value="10.0"/> <!-- Maximum rate (Hz) at which scans and paths are published for visualization, -1.0 to disable. -->
        <param name="kld_err" value="0.05"/>
        <param name="kld_z" value="0.99"/>
        <param name="laser_lambda_short" value="0.1"/>
        <param name="laser_likelihood_max_dist" value="2.0"/>
        <param name="laser_max_beams" value="60"/>	
        <param name="laser_model_type" value="likelihood_field"/>
        <param name="laser_sigma_hit" value="0.2"/>
        <param name="laser_z_hit" value="0.5"/>
        <param name="laser_z_short" value="0.05"/>
        <param name="laser_z_max" value="0.05"/>
        <param name="laser_z_rand" value="0.5"/>
        <param name="max_particles" value="2000"/>
        <param name="min_particles" value="500"/>
        <param name="odom_alpha1" value="0.25"/> <!-- Specifies the expected noise in odometry's rotation estimate from the rotational component of the robot's motion. -->
        <param name="odom_alpha2" value="0.25"/> <!-- Specifies the expected noise in odometry's rotation estimate from translational component of the robot's motion. -->
        <param name="odom_alpha3" value="0.25"/> <!-- Specifies the expected noise in odometry's translation estimate from the translational component of the robot's motion. -->
        <param name="odom_alpha4" value="0.25"/> <!-- Specifies the expected noise in odometry's translation estimate from the rotational component of the robot's motion. -->
        <param name="odom_alpha5" value="0.1"/> <!-- Specifies the expected noise in odometry's translation estimate from the rotational component of the robot's motion. -->
        <param name="odom_frame_id" value="odom"/> <!--原值:odom-->
        <param name="odom_model_type" value="diff"/>
        <param name="recovery_alpha_slow" value="0.001"/> <!-- Exponential decay rate for the slow average weight filter, used in deciding when to recover by adding random poses. -->
        <param name="recovery_alpha_fast" value="0.1"/> <!-- Exponential decay rate for the fast average weight filter, used in deciding when to recover by adding random poses. -->
        <param name="resample_interval" value="1"/> <!-- Number of filter updates required before resampling. -->
        <param name="transform_tolerance" value="1.25"/> <!-- Default 0.1; time with which to post-date the transform that is published, to indicate that this transform is valid into the future. -->
        <param name="update_min_a" value="0.2"/> <!-- Rotational movement required before performing a filter update. 0.1 represents 5.7 degrees  -->
        <param name="update_min_d" value="0.2"/> <!-- Translational movement required before performing a filter update. -->
    
    </node>
 
  <!--move_base中的节点,launch 文件替换-->
  <!-- <include file="$(find xrrobot)/param/navigation/move_base.xml" /> -->
  <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
	  <rosparam file="$(find xrrobot)/param/navigation/$(env XRBASE)/costmap_common_params.yaml" command="load" ns="global_costmap" />
	  <rosparam file="$(find xrrobot)/param/navigation/$(env XRBASE)/costmap_common_params.yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find xrrobot)/param/navigation/local_costmap_params.yaml" command="load" />
    <rosparam file="$(find xrrobot)/param/navigation/global_costmap_params.yaml" command="load" />
	  <rosparam file="$(find xrrobot)/param/navigation/$(env XRBASE)/base_local_planner_params.yaml" command="load" />
    <rosparam file="$(find xrrobot)/param/navigation/move_base_params.yaml" command="load" />
  </node>
 
  <!--位姿发布节点-->
  <node name="robot_pose_publisher" pkg="robot_pose_publisher" type="robot_pose_publisher" >
  <!-- <remap from="/r1/robot_pose" to="/robot1_pose" /> -->
  </node>
 
  <!--多点标记-->
  <node name="multi_mark" pkg="xrrobot" type="show_mark.py" output="screen" />
</group>
</launch>

因为我想让多个小车作为从机,我的电脑作为主机master节点,组成一个编队,在启动小车时给它们创建不同的命名空间,设置第一辆小车namespace=r1,依次启动bring_test.launch和navigate_test.launch时,出现了以下问题:

应该是tf转换出现了问题

1.在没加namespace前tf树是这样的:

2.bring_test.launch和navigate_test.launch都加了namespace=r1后,tf变成了这样:

3.仅bring_test.launch加namespace时:

4.仅navigate_test.launch加了namespace时:

有没有大佬知道怎么解决~憋了好久还是改不过来~

有没有一起做多机协同编队的 ,也可以一起交流下!~