Two turtlebots in Gazebo [closed]
Hello,
I am trying to spawn two turtlebots in gazebo, ROS Electric. I am able to see the turtlebots but I get in Gazebo just /cmd_vel and /odom without the related namespaces (and consequently I can not neither drive nor get the pose of the robots separately). I have already looked at the following topics:
[http://answers.ros.org/question/33981/multiple-turtlebots-in-gazebo/][link text][http://answers.ros.org/question/11506/different-cmd_vel-msgs-to-multiple-robots-on/]
In particular I have modified the file gazebo_ros_create.cpp at line 36:
node_namespaceP_ = new ParamT<std::string>("robotNamespace","",0);
Furthermore, I have modified the gazebo.urdf.xacro file as the following:
<robotnamespace>turtlebot_node</robotnamespace>
This line is in place of:
<node_namespace>turtlebot_node</node_namespace>
I am using two .launch files, one for each robot, I report the first one being different from the other just for the name of the robot.
Thank you for your attention
<launch>
<param name="robot1/robot_description" command="$(find xacro)/xacro.py '$(find turtlebot_description)/urdf/turtlebot.urdf.xacro'"/>
<node name="spawn_turtlebot_model" pkg="gazebo" type="spawn_model" args="$(optenv ROBOT_INITIAL_POSE) -unpause -urdf -param robot_description -x 9 -y 5 -z 0.05 -model turtlebot1 -robot_namespace robot1" respawn="false" output="screen" ns="robot1"/>
<node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" ns="robot1" >
<rosparam command="load" file="$(find turtlebot_bringup)/config/diagnostics.yaml" />
</node>
<node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher" output="screen" ns="robot1">
<param name="publish_frequency" type="double" value="20.0" />
</node>
<!-- The odometry estimator -->
<node ns="robot1" pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf1" >
<param name="freq" value="30.0"/>
<param name="sensor_timeout" value="1.0"/>
<param name="publish_tf" value="true"/>
<param name="odom_used" value="true"/>
<param name="imu_used" value="false"/>
<param name="vo_used" value="false"/>
<param name="output_frame" value="odom"/>
<param name="output_frame" value="odom" />
</node>
<!-- throttling -->
<node pkg="nodelet" type="nodelet" name="pointcloud_throttle" args="load pointcloud_to_laserscan/CloudThrottle openni_manager" respawn="true" ns="robot1">
<param name="max_rate" value="20.0"/>
<remap from="cloud_in" to="/camera/depth/points"/>
<remap from="cloud_out" to="cloud_throttled"/>
</node>
<!-- Fake Laser -->
<node pkg="nodelet" type="nodelet" name="kinect_laser" args="load pointcloud_to_laserscan/CloudToScan openni_manager" respawn="true" ns="robot1">
<param name="output_frame_id" value="/camera_depth_frame"/>
<!-- heights are in the (optical?) frame of the kinect -->
<param name="min_height" value="-0.15"/>
<param name="max_height" value="0.15"/>
<remap from="cloud" to="/cloud_throttled"/>
</node>
<!-- Fake Laser (narrow one, for localization -->
<node pkg="nodelet" type="nodelet" name="kinect_laser_narrow" args="load pointcloud_to_laserscan/CloudToScan openni_manager" respawn="true" ns="robot1">
<param name="output_frame_id" value="/camera_depth_frame"/>
<!-- heights are in the (optical?) frame of the kinect -->
<param name="min_height" value="-0.025"/>
<param name="max_height" value="0.025"/>
<remap from="cloud" to="/cloud_throttled"/>
<remap from="scan" to="/narrow_scan"/>
</node>
</launch>