keyboard_teleop in TurtleBot fails with create.urdf.xacro robot description in multiagent simulation
Good morning to everybody! I was trying to launch a simulation with multiple Create robots when I figured out that the keyboardteleop node under the turtlebotteleop package doe not work with the create robot. To be more clear I paste my code. The following is the code which spawn every robot one_robot.launch
<launch>
<arg name="robot_name"/>
<arg name="init_pose"/>
<arg name="base" value="create"/> <!-- create, roomba-->
<arg name="battery" value="/proc/acpi/battery/BAT0"/> <!-- /proc/acpi/battery/BAT0 -->
<arg name="stacks" value="circles"/> <!-- circles, hexagons -->
<arg name="3d_sensor" value="kinect"/> <!-- kinect, asus_xtion_pro -->
<arg name="urdf_file" default="$(find xacro)/xacro.py '$(find turtlebot_description)/robots/$(arg base)_$(arg stacks)_$(arg 3d_sensor).urdf.xacro'" />
<!-- No namespace here as we will share this description.
Access with slash at the beginning -->
<param name="robot_description" command="$(arg urdf_file)" />
<!-- Gazebo model spawner -->
<node name="spawn_turtlebot_model" pkg="gazebo_ros" type="spawn_model"
args="$(arg init_pose) -unpause -urdf -param robot_description -model $(arg robot_name)" respawn="false" output="screen" />
<!-- Velocity muxer -->
<node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager"/>
<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>
<!-- Bumper/cliff to pointcloud (not working, as it needs sensors/core messages) -->
<include file="$(find turtlebot_bringup)/launch/includes/kobuki/bumper2pc.launch.xml"/>
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
<param name="publish_frequency" type="double" value="30.0" />
</node>
<!-- Fake laser -->
<node pkg="nodelet" type="nodelet" name="laserscan_nodelet_manager" args="manager"/>
<node pkg="nodelet" type="nodelet" name="depthimage_to_laserscan"
args="load depthimage_to_laserscan/DepthImageToLaserScanNodelet laserscan_nodelet_manager">
<param name="scan_height" value="10"/>
<param name="output_frame_id" value="/camera_depth_frame"/>
<param name="range_min" value="0.45"/>
<remap from="image" to="/camera/depth/image_raw"/>
<remap from="scan" to="/scan"/>
</node>
<!-- All the stuff as from usual robot launch file -->
As it is possible to see from the arguments "base" "stacks" and "3d_sensors" I am spawning the robot description of a create robot with circles stacks and a kinect. The I spawned two robots under different name spaces using robots.launch
<launch>
<!-- BEGIN ROBOT 1-->
<group ns="robot1">
<param name="tf_prefix" value="robot1_tf" />
<include file="$(find two_turtlebot)/launch/one_robot.launch" >
<arg name="init_pose" value="-x 1 -y 1 -z 0" />
<arg name="robot_name" value="Robot1" />
</include>
<include file="$(find turtlebot_teleop)/launch/keyboard_teleop.launch" />
</group>
<!-- BEGIN ROBOT 2-->
<group ns="robot2">
<param name="tf_prefix" value="robot2_tf" />
<include file="$(find two_turtlebot)/launch/one_robot.launch" >
<arg name="init_pose" value="-x -4 -y 1 -z 0" />
<arg name="robot_name" value="Robot2" />
</include>
</group>
<node pkg="tf" type="static_transform_publisher" name="odom_frames_connection" args="0 0 0 0 0 0 /robot1_tf/odom /robot2_tf/odom 100"/>
where in the fisrt robot tag I also included the keyboardteleop node. Finally I launch the whole simulation using twocreate.launch
<launch>
<param name="/use_sim_time" value="true" />
<arg name="world_file" default="$(env TURTLEBOT_GAZEBO_WORLD_FILE)"/>
<!-- start world -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="use_sim_time" value="true"/>
<arg name="debug" value="false"/>
<arg name="gui" value="true"/> <!-- graphic interface -->
<arg name="headless" value="false"/>
<arg name="world_name" value="$(arg world_file)"/>
<!--<arg name="world_name" value="worlds/willowgarage.world"/>-->
</include>
<!-- include our robots -->
<include file="$(find two_turtlebot)/launch/robots.launch">
</include>
The problem is that the simulated Create does not respond to keyboard inputs as long as it stays in the namespace /robot1/MyNode even if the topic is correctly published and read.
A nice remark is that I notice that this problem does not happen using the kobuki robot description, in particular changing "base" in kobuki and "stacks" in hexagons the launch file spawns the model of the kobuki turtlebot to which corresponds a different urdf.xacro file. Tracing back the differences between the two urdf.xacro I was able to identify some parameter differences in the gazebo plugins libgazeboroskobuki.so and libgazeboroscreate.so but I cannot quite figure out what is happening of wrong. An other thing to remark is that I installed the turtlebotcreatedesktop package.
Thanks in advance!
Asked by tommy on 2017-11-27 08:08:57 UTC
Comments