Robotics StackExchange | Archived questions

amcl not publishing map -> odom under different namespace

Hello,

I'm attempting to setup a pair of turtlebots that can run simultaneously, and in order to do so, they need to run their nodes on different namespaces while both subscribing to a shared /map topic. I've essentially been trying to apply this guide to real turtlebots. However, I've been facing this issue where amcl is not publishing from map -> odom even though it has all of its necessary prerequisites. I've narrowed it down to being an issue of the namespace change since I am able to run essentially the same code with no issue when the topics don't have a namespace argument in front. I've been trying to figure out where the loose end is but have so far been unsuccessful. My launch files are below:

multi.launch

<launch>
  <param name="/use_sim_time" value="false"/>
  <node pkg="map_server" type="map_server" name="map_server" args="/home/nvidia/maps/serc.yaml">
    <param name="frame_id" value="/map"/>
  </node>

  <include file="/home/nvidia/Desktop/launch/multi_nav.launch">
    <arg name="robot_name" value="robot1" />
  </include>

</launch>

multi_nav.launch

<launch>
  <arg name="robot_name"        default="robot1"/>

<group ns="$(arg robot_name)">
  <arg name="viz"       default="false"/>
  <arg name="base"          default="$(optenv TURTLEBOT_BASE kobuki)"/>  <!-- create, rhoomba -->
  <arg name="stacks"        default="$(optenv TURTLEBOT_STACKS hexagons)"/>  <!-- circles, hexagons -->
  <arg name="3d_sensor"     default="$(optenv TURTLEBOT_3D_SENSOR kinect)"/> <!-- kinect, asus_xtion_pro -->
  <arg name="serialport"        default="$(optenv TURTLEBOT_SERIAL_PORT)"/>

  <param name="tf_prefix" value="$(arg robot_name)"/>

<!--  ***************** Robot Model *****************  -->
<include file="$(find turtlebot_bringup)/launch/includes/robot.launch.xml">
  <arg name="base" value="$(arg base)" />
  <arg name="stacks" value="$(arg stacks)" />
  <arg name="3d_sensor" value="$(arg 3d_sensor)" />
</include>
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
  <param name="use_gui" value="false"/>
</node>

<!-- Command Velocity multiplexer -->
<node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager"/>

<node pkg="nodelet" type="nodelet" name="mobile_base" args="load kobuki_node/KobukiNodelet mobile_base_nodelet_manager">
  <rosparam file="$(find kobuki_node)/param/base.yaml" command="load"/>
  <param name="odom_frame" value="$(arg robot_name)/odom"/>
  <param name="base_frame" value="$(arg robot_name)/base_footprint"/>
  <param name="device_port" value="$(arg serialport)" />

  <remap from="mobile_base/odom" to="/$(arg robot_name)/odom"/>
<!-- Don't do this - force applications to use a velocity mux for redirection  
  <remap from="mobile_base/commands/velocity" to="cmd_vel"/> 
-->
  <remap from="mobile_base/enable" to="enable"/>
  <remap from="mobile_base/disable" to="disable"/>
  <remap from="mobile_base/joint_states" to="/$(arg robot_name)/joint_states"/>
</node>

<node pkg="nodelet" type="nodelet" name="cmd_vel_mux" args="load yocs_cmd_vel_mux/CmdVelMuxNodelet mobile_base_nodelet_manager">
  <param name="yaml_cfg_file" value="$(find turtlebot_bringup)/param/mux.yaml"/>
  <remap from="cmd_vel_mux/output" to="mobile_base/commands/velocity"/>
</node>

<include file="$(find turtlebot_bringup)/launch/includes/kobuki/bumper2pc.launch.xml"/>

<!--  ************** Navigation  ***************  -->
<!--include file="$(find turtlebot_navigation)/launch/includes/move_base.launch.xml"/-->

<!-- rosrun tf static_transform_publisher 0 0 0 0 0 0 base_ftprint laser 100 -->
<node pkg="tf" type="static_transform_publisher" name="laser_link" args="0 0 0 0 0 0 $(arg robot_name)/base_footprint $(arg robot_name)/laser 100"/>

<!-- rosrun urg_node urg_node _ip_address:="192.168.0.10" scan:=base_scan -->
<node pkg="urg_node" type="urg_node" name="urg_node">
  <param name="ip_address"  value="192.168.0.10" />
  <remap from="scan"        to="base_scan" />
  <remap from="laser"       to="$(arg robot_name)/laser" />
</node>

<!-- ***** amcl ***** -->
<include file="$(find amcl)/examples/amcl_multi.launch">
  <arg name="robot_name"    value="$(arg robot_name)"/>
  <arg name="use_map_topic" value="true"/>
  <arg name="odom_frame_id" value="$(arg robot_name)/odom"/>
  <arg name="base_frame_id" value="$(arg robot_name)/base_footprint"/>
  <arg name="global_frame_id" value="/map"/>
</include>

</group>  
</launch>

amcl_multi.launch

<launch>
  <arg name="robot_name"      default="robot1"/>
  <arg name="use_map_topic" default="true"/>
  <arg name="odom_frame_id" default="odom"/>
  <arg name="base_frame_id" default="base_footprint"/>
  <arg name="global_frame_id" default="/map"/>

<node pkg="amcl" type="amcl" name="amcl">
  <remap from="scan" to="base_scan" />
  <remap from="static_map" to="/static_map"/>
  <remap from="map" to="/map" />

  <param name="use_map_topic" value="$(arg use_map_topic)"/>

  <!-- Publish scans from best pose at a max of 10 Hz -->
  <param name="base_frame_id" value="$(arg base_frame_id)"/>
  <param name="global_frame_id" value="$(arg global_frame_id)"/>
  <param name="odom_model_type" value="omni"/>
  <param name="odom_alpha5" value="0.1"/>
  <param name="transform_tolerance" value="0.2" />
  <param name="gui_publish_rate" value="10.0"/>
  <param name="laser_max_beams" value="30"/>
  <param name="min_particles" value="500"/>
  <param name="max_particles" value="5000"/>
  <param name="kld_err" value="0.05"/>
  <param name="kld_z" value="0.99"/>
  <param name="odom_alpha1" value="0.2"/>
  <param name="odom_alpha2" value="0.2"/>
  <!-- translation std dev, m -->
  <param name="odom_alpha3" value="0.8"/>
  <param name="odom_alpha4" value="0.2"/>
  <param name="laser_z_hit" value="0.95"/>
  <param name="laser_z_short" value="0.1"/>
  <param name="laser_z_max" value="0.05"/>
  <param name="laser_z_rand" value="0.05"/>
  <param name="laser_sigma_hit" value="0.2"/>
  <param name="laser_lambda_short" value="0.1"/>
  <param name="laser_model_type" value="likelihood_field"/>
  <!-- <param name="laser_model_type" value="beam"/> -->
  <param name="laser_likelihood_max_dist" value="2.0"/>
  <param name="update_min_d" value="0.2"/>
  <param name="update_min_a" value="0.5"/>
  <param name="odom_frame_id" value="$(arg odom_frame_id)"/>
  <param name="resample_interval" value="1"/>
  <param name="transform_tolerance" value="0.1"/>
  <param name="recovery_alpha_slow" value="0.001"/>
  <param name="recovery_alpha_fast" value="0.1"/>
</node>
</launch>

after running multi.launch, rqttftree does not show the tf from map to robot1/odom.

rosnode info /robot1/amcl shows the following:

Node [/robot1/amcl]
Publications: 
* /robot1/amcl/parameter_descriptions [dynamic_reconfigure/ConfigDescription]
* /robot1/amcl/parameter_updates [dynamic_reconfigure/Config] 
* /robot1/amcl_pose [geometry_msgs/PoseWithCovarianceStamped]
* /robot1/particlecloud [geometry_msgs/PoseArray]
* /rosout [rosgraph_msgs/Log]
* /tf [tf2_msgs/TFMessage]
Subscriptions: 
* /map [nav_msgs/OccupancyGrid]
* /robot1/base_scan [sensor_msgs/LaserScan]
* /robot1/initialpose [unknown type]
* /tf [tf2_msgs/TFMessage]
* /tf_static [tf2_msgs/TFMessage]
Services: 
* /robot1/amcl/get_loggers
* /robot1/amcl/set_logger_level
* /robot1/amcl/set_parameters
* /robot1/global_localization
* /robot1/request_nomotion_update
* /robot1/set_map
contacting node http://10.108.93.240:37641/ ...
Pid: 29864
Connections:
* topic: /rosout
 * to: /rosout
 * direction: outbound
 * transport: TCPROS
* topic: /tf
 * to: /robot1/amcl
 * direction: outbound
 * transport: INTRAPROCESS
* topic: /tf
 * to: /rqt_gui_py_node_30845
 * direction: outbound
 * transport: TCPROS
* topic: /tf
 * to: /robot1/amcl (http://10.108.93.240:37641/)
 * direction: inbound
 * transport: INTRAPROCESS
* topic: /tf
 * to: /robot1/robot_state_publisher (http://10.108.93.240:42187/)
 * direction: inbound
 * transport: TCPROS
* topic: /tf
 * to: /robot1/laser_link (http://10.108.93.240:33779/)
 * direction: inbound
 * transport: TCPROS
* topic: /tf
 * to: /robot1/mobile_base_nodelet_manager (http://10.108.93.240:35872/)
 * direction: inbound
 * transport: TCPROS
* topic: /tf_static
 * to: /robot1/robot_state_publisher (http://10.108.93.240:42187/)
 * direction: inbound
 * transport: TCPROS
* topic: /robot1/base_scan
 * to: /robot1/urg_node (http://10.108.93.240:33308/)
 * direction: inbound
 * transport: TCPROS
* topic: /map
 * to: /map_server (http://10.108.93.240:36556/)
 * direction: inbound
 * transport: TCPROS

In case it helps, I'm using Ubuntu 16.04 on an NVIDIA Jetson TX2 with a Kobuki base and Hokuyo laser scanner. Any help or tips for how to get amcl to recognize the change in namespace would be greatly appreciated!

Asked by Lemonaidan on 2019-07-01 13:27:18 UTC

Comments

What does your TF tree look like?

Asked by AndreasLydakis on 2019-07-11 03:35:24 UTC

How did you solve the original problem posed? I am facing the same problem where AMCL is not broadcasting from map -> odom when base_frame_id and odom_frame_id have a namespace argument in front.

Asked by Roberto Z. on 2020-08-21 01:33:35 UTC

Answers