Kinect plugin interrupting robot spawning in Gazebo

asked 2020-01-13 21:36:41 -0600

yoo00 gravatar image

I am having a trouble of getting Kinect rostopics up in Gazebo. When spawning the robot with Kinect (only the URDF not the plugin), the robot with Kinect is correctly spawned but I don't have any Kinect-related rostopics. However, when including the Kinect plugin in order to have Kinect-related rostopics, the robot's arms collide with each other and keeps shaking itself (the final shaking pose of the robot becomes random).

This is related to the reference name of <gazebo> in the kinect.urdf.xacro file I included below. <gazebo reference="${prefix}_ir_frame"> is the correct one but it screws up the robot spawning. If I change it to another name, e.g., `<gazebo reference="${prefix}_ir_link">, robot spawning is fine but Kinect rostopics are not there. The ROS version I am using is ROS Kinectic in Ubuntu 16.04 and the Gazebo version is 7.16.0.

I commented out <collision> from kinect.urdf.xacro but it didn't work. I really don't get why it is happening.. I hope someone could help me out. Thanks!

Robot Gazebo launch file:

<?xml version="1.0"?>
   <arg name="limited" default="false"/>
   <arg name="paused" default="false"/>
   <arg name="gui" default="true"/>
   <arg name="world" default="worlds/"/>
   <arg name="x"   default="0.0"/>
   <arg name="y"   default="0.0"/>
   <arg name="z"   default="0.0"/>

<!-- send robot urdf to param server -->
<include file="$(find robot_description)/launch/robot_upload.launch"/>
   <rosparam file="$(find robot_gazebo)/controller/gazebo_ros_control_gains.yaml" command="load"/>

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

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

<!-- push robot_description to factory and spawn robot in gazebo -->
<node name="spawn_gazebo_model" pkg="gazebo_ros" type="spawn_model" 
args="-urdf -param /robot_description -model robot -x $(arg x) -y $(arg y) -z $(arg z)" 
respawn="false" output="screen" />

<rosparam file="$(find robot_gazebo)/controller/right_arm_controller.yaml" command="load"/>
<rosparam file="$(find robot_gazebo)/controller/left_arm_controller.yaml" command="load"/>
<rosparam file="$(find robot_gazebo)/controller/right_gripper_controller.yaml" command="load"/>
<rosparam file="$(find robot_gazebo)/controller/left_gripper_controller.yaml" command="load"/>
<rosparam file="$(find robot_gazebo)/controller/head_controller.yaml" command="load"/>
<rosparam file="$(find robot_gazebo)/controller/torso_controller.yaml" command="load"/>
<rosparam file="$(find robot_gazebo)/controller/joint_state_controller.yaml" command="load"/>
<node name="default_controller_spawner" pkg="controller_manager"
      type="controller_manager" args="spawn

kinect.urdf.xacro file:

<?xml version="1.0"?>
<robot xmlns:xacro="" name="kinect_sensor">
<xacro:macro name="kinect_sensor" params="prefix parent *origin ...
edit retag flag offensive close merge delete