ROS Gazebo issue between joint and link in simulation
I'm just getting started with ROS Kinetic and trying to design and simulate a simple designed four-wheeled driving robot. In the xacro/urdf file, I defined it to consist of four wheels and a rectangular chassis. When I opened this model in Rviz, I can see that the model is connected as expected, with all four wheels attached to the chassis.
However, when I spawn the same robot in Gazebo (referencing the same xacro file), the chassis is connected to two of the wheels (due to the two joint types defined as 'fixed'). The other two wheels is 'not' connected and the chassis is on ground plane next to the two wheels (with the joint type defined as 'continuous'). When trying to simulate driving this model using ROS's teleop_twist_keyboard package, the motion of the two 'fixed' wheels don't move (connected to the chassis), and the other two wheels will move the whole body while revolving against 'air'. Below is a video of the simulation: https://youtu.be/nWNa54ZzeXE
Xacro File of the Robot:
<?xml version="1.0" ?>
<robot name="two_wheel_robot" xmlns:xacro="http://www.ros.org/wiki/xacro">
<material name="black">
<color rgba="0.0 0.0 0.0 1.0"/>
</material>
<material name="blue">
<color rgba="0.203125 0.23828125 0.28515625 1.0"/>
</material>
<material name="green">
<color rgba="0.0 0.8 0.0 1.0"/>
</material>
<material name="grey">
<color rgba="0.2 0.2 0.2 1.0"/>
</material>
<material name="orange">
<color rgba="1.0 0.423529411765 0.0392156862745 1.0"/>
</material>
<material name="brown">
<color rgba="0.870588235294 0.811764705882 0.764705882353 1.0"/>
</material>
<material name="red">
<color rgba="0.80078125 0.12890625 0.1328125 1.0"/>
</material>
<material name="white">
<color rgba="1.0 1.0 1.0 1.0"/>
</material>
<gazebo reference="link_chassis">
<material>Gazebo/Orange</material>
</gazebo>
<gazebo reference="link_left_wheel">
<material>Gazebo/Blue</material>
</gazebo>
<gazebo reference="link_right_wheel">
<material>Gazebo/Blue</material>
</gazebo>
<gazebo>
<plugin filename="libgazebo_ros_diff_drive.so" name="differential_drive_controller">
<legacyMode>false</legacyMode>
<alwaysOn>true</alwaysOn>
<updateRate>20</updateRate>
<leftJoint>joint_left_wheel</leftJoint>
<rightJoint>joint_right_wheel</rightJoint>
<rightJoint>front_joint_right_wheel</rightJoint>
<leftJoint>front_joint_left_wheel</leftJoint>
<wheelSeparation>0.2</wheelSeparation>
<wheelDiameter>0.2</wheelDiameter>
<torque>0.5</torque>
<commandTopic>cmd_vel</commandTopic>
<odometryTopic>odom</odometryTopic>
<odometryFrame>odom</odometryFrame>
<robotBaseFrame>link_chassis</robotBaseFrame>
</plugin>
</gazebo>
<link name="link_chassis">
<!-- pose and inertial -->
<pose>0 0 0.1 0 0 0</pose>
<inertial>
<mass value="5"/>
<origin rpy="0 0 0" xyz="0 0 0.1"/>
<inertia ixx="0.0395416666667" ixy="0" ixz="0" iyy="0.106208333333" iyz="0" izz="0.106208333333"/>
</inertial>
<!-- body -->
<collision name="collision_chassis">
<geometry>
<box size="1.0 0.6 0.07"/>
</geometry>
</collision>
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<box size="1.0 0.6 0.07"/>
</geometry>
<material name="blue"/> ...