Robot Drifting in rviz
Hello I have my custom made robot URDF which I a using to simulate the robot in rviz, I am publishing the odo data over TF for simulation.
But When I give velocity (fake) as vx =1, vy = -1 and angular velocity as 0, then robot actually drifts, ie. the robot is not moving as expected, it moves in a straight line with at an angle of 45 deg from the origin and even the orientation or heading of the robot doesn't match with the direction of the moment of the robot.
The urdf for my robot is as below:
<link name="base_link">
<inertial>
<mass value="1"/>
<inertia ixx="100" ixy="0" ixz="0" iyy="100" iyz="0" izz="100" />
<origin/>
</inertial>
<visual>
<geometry>
<box size="0.6 0.35 0.15"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="white">
<color rgba="0.2 1 0.3 1"/>
</material>
</visual>
</link>
<link name="lwheel">
<visual>
<geometry>
<cylinder length="0.04" radius="0.1"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
<joint name="base_to_lwheel" type="fixed">
<parent link="base_link"/>
<child link="lwheel"/>
<origin xyz="-0.1 -0.2 -0.025" rpy="1.5708 0 0"/>
<axis xyz="-0.1 -0.2 -0.025 " />
</joint>
<link name="rwheel">
<visual>
<geometry>
<cylinder length="0.04" radius="0.1"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
<joint name="base_to_rwheel" type="fixed">
<parent link="base_link"/>
<child link="rwheel"/>
<origin xyz="-0.1 0.2 -0.025" rpy="-1.5708 0 0"/>
</joint>
<link name="fwheel_left">
<visual>
<geometry>
<cylinder length="0.05" radius="0.03"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
<joint name="base_to_fwheel_left" type="fixed">
<parent link="base_link"/>
<child link="fwheel_left"/>
<origin xyz="0.22 -0.1 -0.095" rpy="1.5708 0 0"/>
</joint>
<link name="fwheel_right">
<visual>
<geometry>
<cylinder length="0.05" radius="0.03"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
<joint name="base_to_fwheel_right" type="fixed">
<parent link="base_link"/>
<child link="fwheel_right"/>
<origin xyz="0.22 0.1 -0.095" rpy="-1.5708 0 0"/>
</joint>
<link name="scanner">
<visual>
<geometry>
<box size="0.28 0.065 0.04"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
<link name="scan_support">
<visual>
<geometry>
<cylinder length="0.4" radius="0.015"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
<material name="black">
<color rgba="1 0.2 0.1 1"/>
</material>
</visual>
</link>
<joint name="base_to_scan_support" type="fixed">
<parent link="base_link"/>
<child link="scan_support"/>
<origin xyz="0.15 0 0.25" rpy="0 0 0"/>
</joint>
<joint name="base_to_scanner" type="fixed ...
Is your robot holonomic or non-holonomic? For a holonomic robot, what you describe seems to be the correct behavior
Frankly speaking I don't know the difference between holonomic and non-holonomic mine is a differential drive.
Here is a short explanation about the holonomic robots http://en.wikipedia.org/wiki/Holonomic_(robotics) Anyway, if your robot is differential drive and doesn't have omnidirectional wheels then it is non-holonomic and it should not be able to move as you describe.
could you post more info? Like the URDF file, which nodes are you exactly running, any source code that could give us some more clues?
I have edited my question with the required information, can you please refer back to the question and guide me if you get some insights into the problem
Martin, But if I use the example code in the link: //wiki.ros.org/urdf/Tutorials/Using urdf with robot_state_publisher I am getting the perfect result as desired but what's the difference between both.