ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The position of the robot is determined when calling the node spawn_model from the package gazebo_ros. This node is called at the line <include file="$(find turtlebot_gazebo)/launch/includes/$(arg base).launch.xml">. It will call the launch file kobuki.launch.xml. In this file you have :

  <!-- Gazebo model spawner -->
  <node name="spawn_turtlebot_model" pkg="gazebo_ros" type="spawn_model"
        args="$(optenv ROBOT_INITIAL_POSE) -unpause -urdf -param robot_description -model turtlebot"/>

Your solution is to create a new launch file similar to turtlebot_world.launch and instead of using the include to kobuki.launch.xml copy the content direclty in your launch file and remove the argument $(optenv ROBOT_INITIAL_POSE) to set your pose, using the arguments -x, -y, -Y (for yaw) like this :

<node name="spawn_turtlebot_model" pkg="gazebo_ros" type="spawn_model" args="-x 5 -y 0 -Y 0 -unpause -urdf -param robot_description -model turtlebot"/>

Or if you don't want to change anything you can directly set the envirronment variable ROBOT_INITIAL_POSE to the desired arguments :

export ROBOT_INITIAL_POSE="-x 5 -y 0 -Y 0"

Note that after executing this you have to use roslaunch in the same terminal.

The position of the robot is determined when calling the node spawn_model from the package gazebo_ros. This node is called at the line <include file="$(find turtlebot_gazebo)/launch/includes/$(arg base).launch.xml">. It will call the launch file kobuki.launch.xml. In this file you have :

  <!-- Gazebo model spawner -->
  <node name="spawn_turtlebot_model" pkg="gazebo_ros" type="spawn_model"
        args="$(optenv ROBOT_INITIAL_POSE) -unpause -urdf -param robot_description -model turtlebot"/>

Your solution is to create a new launch file similar to turtlebot_world.launch and instead of using the include to kobuki.launch.xml copy the content direclty in your launch file and remove the argument $(optenv ROBOT_INITIAL_POSE) to set your pose, using the arguments -x, -y, -Y (for yaw) like this :

  <!-- Gazebo model spawner -->
  <node name="spawn_turtlebot_model" pkg="gazebo_ros" type="spawn_model" type="spawn_model"
        args="-x 5 -y 0 -Y 0 -unpause -urdf -param robot_description -model turtlebot"/>

turtlebot"/>

Or if you don't want to change anything you can directly set the envirronment variable ROBOT_INITIAL_POSE to the desired arguments :

export ROBOT_INITIAL_POSE="-x 5 -y 0 -Y 0"

Note that after executing this you have to use roslaunch in the same terminal.