How to connect my Motion planning to my gazebo model

asked 2021-05-18 10:42:54 -0500

dev4all12358 gravatar image

updated 2021-05-18 11:31:17 -0500


I try to connect the moveit panda arm demo to the model I generate with setup assistant of moveit. To launch the panda arm in rviz I launch :

roslaunch panda_moveit_config demo.launch

Rviz run properly, the I use the model I generate with setup assistante in gazebo: In one terminal I run: roslaunch gazebo_ros empty_world.launch paused:=true use_sim_time:=false gui:=true throttled:=false recording:=false debug:=true

In other:

rosrun gazebo_ros spawn_model -file ./panda_arm.gazebo -urdf -x 0 -y 0 -z 1 -model panda

The arm is properly display but its position doesn't math with the rviz robot position. And when I plan trajectory in rviz, the arm is not moving in gazebo.

Here is the result: image description

Here is the modified demo.launch


  <!-- By default, we do not start a database (it can be large) -->
  <arg name="db" default="false" />
  <!-- Allow user to specify database location -->
  <arg name="db_path" default="$(find panda_moveit_config)/default_warehouse_mongo_db" />

  <!-- By default, we are not in debug mode -->
  <arg name="debug" default="true" />
  <arg name="pipeline" default="ompl" />

  By default, hide joint_state_publisher's GUI

  MoveIt!'s "demo" mode replaces the real robot driver with the joint_state_publisher.
  The latter one maintains and publishes the current joint configuration of the simulated robot.
  It also provides a GUI to move the simulated robot around "manually".
  This corresponds to moving around the real robot without the use of MoveIt.
  <arg name="rviz_tutorial" default="false" />
  <arg name="use_gui" default="false" />

  <!-- Load the URDF, SRDF and other .yaml configuration files on the param server -->
  <include file="$(find panda_moveit_config)/launch/planning_context.launch">
    <arg name="load_robot_description" value="true"/>

  <arg name="initial_joint_states"
    default=" -J panda::panda_joint1 0.000
              -J panda::panda_joint2 0.0
              -J panda::panda_joint3 0.0
              -J panda::panda_joint4 0.0
              -J panda::panda_joint5 0.0
              -J panda::panda_joint6 0.0
              -J panda::panda_joint7 0.0"/>

    <arg name="world" default="empty"/> 
  <arg name="paused" default="false"/>
  <arg name="use_sim_time" default="true"/>
  <arg name="gui" default="true"/>
  <arg name="headless" default="false"/>

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <!--arg name="world_name" value="$(find mybot_gazebo)/worlds/"/-->
    <arg name="paused" value="$(arg paused)"/>
    <arg name="use_sim_time" value="$(arg use_sim_time)"/>
    <arg name="gui" value="$(arg gui)"/>
    <arg name="headless" value="$(arg headless)"/>
    <arg name="debug" value="$(arg debug)"/>

    <node name="mybot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
   args="-urdf -param robot_description_semantic -model panda $(arg initial_joint_states)" />

  <!-- create a tf with base frame as 'base' (to match aml_robot) -->
  <node pkg="tf" type="static_transform_publisher" name="base_to_link0" args="0 0 0 0 0 0 1 base panda_link0 100" />
  <node pkg="tf" type="static_transform_publisher" name="world_to_base" args="0 0 0 0 0 0 1 world base 100" />

  <!-- If needed, broadcast static tf for robot root -->
  <node pkg="tf2_ros" type="static_transform_publisher" name="virtual_joint_broadcaster_1" args="0 0 0 0 0 0 world panda_link0" />

  <!-- We do not have a robot connected, so publish fake joint states -->
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
    <param name="/use_gui" value="$(arg use_gui)"/>
    <rosparam param="/source_list">[/move_group/fake_controller_joint_states]</rosparam>
  <node ...
edit retag flag offensive close merge delete