Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Joint Controller does not move robot arm in Gazebo (but works in RViz)

Hello All,

My problem is that when publishing a message to the joint state controller, I can see the robot moves it's arms in RViz but not in Gazebo. Can anyone help me figure out what is wrong?

My launch file is as follow:

<arg name="limited" default="false" doc="If true, limits joint range [-PI, PI] on all joints." />
<arg name="paused" default="true" doc="Starts gazebo in paused mode" />
<arg name="gui" default="true" doc="Starts gazebo gui" />

<!-- startup simulated world -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" default="$(find ps)/worlds/ps.world"/>
    <arg name="paused" value="$(arg paused)"/>
    <arg name="gui" value="$(arg gui)"/>
</include>

<!-- send robot urdf to param server -->
<include file="$(find ur_description)/launch/ur5_upload.launch">
    <arg name="limited" value="$(arg limited)"/>
</include>

<!-- UR5 and the Intel Realsense -->
<param name="robot_description" command="$(find xacro)/xacro  --inorder '$(find ps)/urdf/robot.xacro'" />

<!-- push camera to gazebo -->
<node name="spawn_camera" pkg="gazebo_ros" type="spawn_model" args="-unpause -urdf -param robot_description -model robot -z 0.1" respawn="false" output="screen" />


<!-- Robot state publisher -->
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
    <param name="publish_frequency" type="double" value="5.0" />
    <param name="tf_prefix" type="string" value="" />
</node>


<!-- Fake Calibration -->
<node pkg="rostopic" type="rostopic" name="fake_joint_calibration" args="pub /calibrated std_msgs/Bool true" />

<!-- joint_state_controller -->
<!-- <rosparam file="$(find ur_gazebo)/controller/joint_state_controller.yaml" command="load"/> -->
<rosparam file="$(find petscanner)/config/joint_state_controller.yaml" command="load"/>
<node name="joint_state_controller_spawner" pkg="controller_manager" type="controller_manager" args="spawn joint_state_controller" respawn="false" output="screen"/>


<!-- bring up joint controller gui -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
    <param name="use_gui" value="true"/>
</node>

<node name="rviz" pkg="rviz" type="rviz" args="-d $(find ur_description)/cfg/view_robot.rviz" />

I can move the joints with the joint_state_publisher gui and see the corresponding change in RViz, but the gazebo pose is static.

Is there something in Gazebo (or URDF file) that I am missing? The URDF file (robot.xacro) is as follow:

<?xml version="1.0"?>
<robot name="robot_description" 
  xmlns:xacro="http://ros.org/wiki/xacro">

  <xacro:include filename="$(find ur5_description)/urdf/ur5_joint_limited_robot.urdf.xacro" />

  <xacro:include filename="$(find ur_description)/urdf/common.gazebo.xacro" />


  <!-- CAMERA -->

  <xacro:include filename="$(find realsense2_description)/urdf/_d435.urdf.xacro"/>
  <xacro:arg name="use_nominal_extrinsics" default="True" />

  <xacro:sensor_d435 parent="tool0">
    <origin xyz="0 0 0.01" rpy="0 -1.57 0"/>
  </xacro:sensor_d435>


</robot>

Thank you,

Iyantiram

Joint Controller does not move robot arm in Gazebo (but works in RViz)

Hello All,

My problem is that when publishing a message to the joint state controller, I can see the robot moves it's arms in RViz but not in Gazebo. Can anyone help me figure out what is wrong?wrong? Going through similar questions, it seems like the joint_state_publisher and the libgazebo_ros_control.so plugins have to be added, and I did so.

My launch file is as follow:I have this:

<arg name="limited" default="false" doc="If true, limits joint range [-PI, PI] on all joints." />
<arg name="paused" default="true" doc="Starts gazebo in paused mode" />
<arg name="gui" default="true" doc="Starts gazebo gui" />

<!-- startup simulated world -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<plugin name="ros_control" filename="libgazebo_ros_control.so">
 <!--robotNamespace>/</robotNamespace-->
 <arg name="world_name" default="$(find ps)/worlds/ps.world"/>
    <arg name="paused" value="$(arg paused)"/>
    <arg name="gui" value="$(arg gui)"/>
</include>

<!-- send robot urdf to param server -->
<include file="$(find ur_description)/launch/ur5_upload.launch">
    <arg name="limited" value="$(arg limited)"/>
</include>

<!-- UR5 and the Intel Realsense -->
<param name="robot_description" command="$(find xacro)/xacro  --inorder '$(find ps)/urdf/robot.xacro'" />

<!-- push camera to gazebo -->
<node name="spawn_camera" pkg="gazebo_ros" type="spawn_model" args="-unpause -urdf -param robot_description -model robot -z 0.1" respawn="false" output="screen" />
<!--robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType-->
</plugin>
<!-- Robot state publisher --> <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"> <param name="publish_frequency" type="double" value="5.0" /> <param name="tf_prefix" type="string" value="" /> </node>

and this:

<!-- Fake Calibration --> <node pkg="rostopic" type="rostopic" name="fake_joint_calibration" args="pub /calibrated std_msgs/Bool true" /> <!-- joint_state_controller --> <!-- <rosparam file="$(find ur_gazebo)/controller/joint_state_controller.yaml" command="load"/> --> <rosparam file="$(find petscanner)/config/joint_state_controller.yaml" command="load"/> <node name="joint_state_controller_spawner" pkg="controller_manager" type="controller_manager" args="spawn joint_state_controller" respawn="false" output="screen"/> <!-- bring up joint controller gui -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
    <param name="use_gui" value="true"/>
</node>

<node name="rviz" pkg="rviz" type="rviz" args="-d $(find ur_description)/cfg/view_robot.rviz" />

I can move in my urdf and launch files.

Yet, when changing the joints with the joint_state_publisher gui and see joint-publisher-gui, the corresponding change changes are reflected in RViz, RViz but the gazebo pose is static.not in gazebo.

Is there something in Gazebo (or URDF file) that I am missing? The URDF file (robot.xacro) is as follow:

<?xml version="1.0"?>
<robot name="robot_description" 
  xmlns:xacro="http://ros.org/wiki/xacro">

  <xacro:include filename="$(find ur5_description)/urdf/ur5_joint_limited_robot.urdf.xacro" />

  <xacro:include filename="$(find ur_description)/urdf/common.gazebo.xacro" />


  <!-- CAMERA -->

  <xacro:include filename="$(find realsense2_description)/urdf/_d435.urdf.xacro"/>
  <xacro:arg name="use_nominal_extrinsics" default="True" />

  <xacro:sensor_d435 parent="tool0">
    <origin xyz="0 0 0.01" rpy="0 -1.57 0"/>
  </xacro:sensor_d435>


</robot>

Thank you,

Iyantiram