Robotics StackExchange | Archived questions

Change Gazebo Default Robot pose

Dear Community,

my UR10 robot in gazebo starts in a very bad initial orientation which makes it really hard to plan out of. Therefore i want to change the initaial configuration.

i start the simulation using the launchfile:

<launch>

  <arg name="limited" default="true" doc="limit the joints"/>
  <arg name="pipeline" default="pilz_industrial_motion_planner" /> <!-- ompl for normal operation and pilz_industrial_motion_planner for the industrial-->


  <!--bring up ur10 robot in gazebo-->
  <include file="$(find ur_gazebo)/launch/ur10_bringup.launch"/>
    <!--No 'limited' in ur10 bringup arg name="limited" value="$(arg limited)"/-->
  <!--/include-->

  <!--delay, not necessary-->
  <node pkg="timed_roslaunch" type="timed_roslaunch.sh" args="3 $(find ur10_moveit_config)/launch/ur10_moveit_planning_execution_sim.launch pipeline:=$(arg pipeline)" name="timed_roslaunch" output="screen" />

  <!--run configuration package for moveit motion planning-->
  <!--include file="$(find ur10_moveit_config)/launch/ur10_moveit_planning_execution_sim.launch"/-->

  <!--A dome shape trajectory moving around the part to be recorded-->
  <!--node name="move_node" pkg="fmp_move_traj" type="move_dome.py" output="screen"/-->

  <!--An action for dataset recording-->
  <!--node name="pipelime_node" pkg="fmp_pipelime_dataset" type="fmp_pipelime_dataset_server.py" output="screen"/-->

</launch>

i suspect this means i must modify the ur10_bringup.launch. Which looks like: <?xml version="1.0"?> <!-- Main entry point for loading a single UR10 into Gazebo, in isolation, in the empty world.

    A set of ros_control controllers similar to those loaded by ur_robot_driver
    will be loaded by 'ur_control.launch.xml' (note: *similar*, *not* identical).

    This bringup .launch file is intentionally given the same name as the one in
    the ur_robot_driver package, as it fulfills a similar role: loading the
    configuration and starting the necessary ROS nodes which in the end provide
    a ROS API to a Universal Robots UR10. Only in this case, instead of a real
    robot, a virtual model in Gazebo is used.

    NOTE 1: as this is not a real robot, there are limits to the faithfulness
    of the simulation. Dynamic behaviour will be different from a real robot.
    Only a subset of topics, actions and services is supported. Specifically,
    interaction with the Control Box itself is not supported, as Gazebo does not
    simulate a Control Box. This means: no Dashboard server, no URScript topic
    and no force-torque sensor among other things.

    NOTE 2: users wishing to integrate a UR10 with other models into a more
    complex simulation should NOT modify this file. Instead, if it would be
    desirable to reuse this file with a custom simulation, they should create a
    copy and update this copy so as to accomodate required changes.

    In those cases, treat this file as an example, showing one way how a Gazebo
    simulation for UR robots *could* be launched. It is not necessary to mimic
    this setup completely.
  -->

  <!--Robot description and related parameter files -->
  <arg name="robot_description_file" default="$(dirname)/inc/load_ur10.launch.xml" doc="Launch file which populates the 'robot_description' parameter."/>
  <arg name="joint_limit_params" default="$(find ur_description)/config/ur10/joint_limits.yaml"/>
  <arg name="kinematics_params" default="$(find ur_description)/config/ur10/default_kinematics.yaml"/>
  <arg name="physical_params" default="$(find ur_description)/config/ur10/physical_parameters.yaml"/>
  <arg name="visual_params" default="$(find ur_description)/config/ur10/visual_parameters.yaml"/>

  <!-- Controller configuration -->
  <arg name="controller_config_file" default="$(find ur_gazebo)/config/ur10_controllers.yaml" doc="Config file used for defining the ROS-Control controllers."/>
  <arg name="controllers" default="joint_state_controller pos_joint_traj_controller" doc="Controllers that are activated by default."/>
  <arg name="stopped_controllers" default="joint_group_pos_controller" doc="Controllers that are initally loaded, but not started."/>

  <!-- robot_state_publisher configuration -->
  <arg name="tf_prefix" default="" doc="tf_prefix used for the robot."/>
  <arg name="tf_pub_rate" default="125" doc="Rate at which robot_state_publisher should publish transforms."/>

  <!-- Gazebo parameters -->
  <arg name="paused" default="false" doc="Starts Gazebo in paused mode" />
  <arg name="gui" default="true" doc="Starts Gazebo gui" />

  <!-- Load urdf on the parameter server -->
  <include file="$(arg robot_description_file)">
    <arg name="joint_limit_params" value="$(arg joint_limit_params)"/>
    <arg name="kinematics_params" value="$(arg kinematics_params)"/>
    <arg name="physical_params" value="$(arg physical_params)"/>
    <arg name="visual_params" value="$(arg visual_params)"/>
  </include>

  <!-- Robot state publisher -->
  <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
    <param name="publish_frequency" type="double" value="$(arg tf_pub_rate)" />
    <param name="tf_prefix" value="$(arg tf_prefix)" />
  </node>

  <!-- Start the 'driver' (ie: Gazebo in this case) -->
  <include file="$(dirname)/inc/ur_control.launch.xml">
    <arg name="controller_config_file" value="$(arg controller_config_file)"/>
    <arg name="controllers" value="$(arg controllers)"/>
    <arg name="gui" value="$(arg gui)"/>
    <arg name="paused" value="$(arg paused)"/>
    <arg name="stopped_controllers" value="$(arg stopped_controllers)"/>
  </include>
</launch>

so, no i have no idea aht to do. I try to implement what is written in https://answers.ros.org/question/40627/how-do-i-set-the-inital-pose-of-a-robot-in-gazebo/ but not sure how.

Any help is appreciated!

Asked by Infraviored on 2023-01-17 10:20:10 UTC

Comments

Answers

I assume you are using moveit for the manipulation. And you are on simulation not on the actual robot

This launch file has nothing to do with the robot's initial position.

There can be several solutions,

  • Change the initial orientation in the urdf file.
  • Change the initial/home position while making a moveit package.
  • May be the easiest one is to move the robot in the joint space programmatically to the desired joint orientation before staring the actual planning. Link for python exampleand link for the cpp example. (This works for the actual robot as well)

Asked by aarsh_t on 2023-01-20 05:38:51 UTC

Comments