Model bounces in reaction to teleop_twist_keyboard input
I have my robot model spawned into a gazebo world and I am attempting to drive it around using teleop.
When I push i to innitiate movement the robot flips up on it's rear wheels and almost flips over. Increasing the speed also creates unpredictable reactions. Stopping the robot also creates what I can only describe as a "bouncing effect". I inserted a screenshot below:
The image above shows the robot flipping and bouncing after I pushed the stop (k) button. It's even worse when I try getting the robot to turn left or right.
I'm looking for suggestions on what could be causing this behaviour and how I can fix it, please.
*Update: *
URDF code added (with the exception of the ouster_description package lidar, inthe interest of preserving space) below as requested:
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="SweepBOT">
<!-- body -->
<xacro:property name="chasis_length" value="1.0"/>
<xacro:property name="chasis_heigth" value="0.45"/>
<xacro:property name="chasis_width" value="0.5"/>
<link name="chasis">
<inertial>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<mass value="1.0"/>
<inertia ixx="0.4" ixy="0.0" ixz="0.0" iyy="0.4" iyz="0.0" izz="0.2"/>
</inertial>
<visual name="">
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<geometry>
<box size="${chasis_length} ${chasis_heigth} ${chasis_width}"/>
</geometry>
<material name="">
<color rgba="0.0 1.0 0.0 1.0"/>
</material>
</visual>
<collision>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<geometry>
<box size="${chasis_length} ${chasis_heigth} ${chasis_width}"/>
</geometry>
</collision>
</link>
<gazebo reference='chasis'>
<material>Gazebo/Orange</material>
</gazebo>
<!-- WHEELS -->
<xacro:property name="wheel_radius" value="0.1"/>
<xacro:property name="wheel_length" value="0.1"/>
<xacro:property name="wheel_rpy" value="1.57075 0 0"/>
<xacro:macro name="wheel" params="side position flip alt">
<xacro:property name="wheel_xyz" value="${alt * 0.3} ${flip * 0.2} -0.25"/>
<link name="wheel_${side}_${position}">
<inertial>
<mass value="1.0"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
<visual name="">
<origin xyz="0 0 0" rpy="${wheel_rpy}"/>
<geometry>
<cylinder radius="${wheel_radius}" length="${wheel_length}"/>
</geometry>
<material name="">
<color rgba="1.0 0.0 0.0 1.0"/>
<texture filename=""/>
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="${wheel_rpy}"/>
<geometry>
<cylinder radius="${wheel_radius}" length="${wheel_length}"/>
</geometry>
</collision>
</link>
<gazebo reference='"wheel_${side}_${position}'>
<material>Gazebo/Red</material>
</gazebo>
<joint name="body_wheel_${side}_${position}_joint" type="continuous">
<parent link="chasis"/>
<child link="wheel_${side}_${position}"/>
<limit lower ...
Are the wheels spinning the way you expect for forward, backward, and turning motions? You may check by making your robot "float" with a fixed joint between
world
andbase_link
, so physics doesn't get in the way as suggested in this Gazebo answer. If that works, then the issue may be your physical parameters (inertia, friction, etc.). Either way, you should post your URDF file(s) for further troubleshooting.@tryan: Hello again :-)
I added my urdf code as you requested.
Regarding the spinning movements of the wheels, I am certain they are moving in the right and required directions. I can get the model to move without issue if I reduce the to almost zero. That is particularly important when the robot is starting from stand still. Increasing the speed tends to have the "galloping horse" effect where the robot lifts up on it's rear wheels, comes down on all four wheels and then picks up speed.
Haha, hi, @sisko! I remember the tumbling wheels now :)
Looking a little closer at the URDF, it seems the wheels have significantly more inertia than the chassis (and too much for their mass value). The Husky's URDF provides an example of some real values
ixx="0.02467" ixy="0" ixz="0" iyy="0.04411" iyz="0" izz="0.02467"
. You can use your mass value and the formula for a solid cylinder from Wikipedia's List of Moments of Inertia:where m is the mass, r is the radius, and h is the height (wheel width). You could also increase your chassis' mass (the Husky's is ~46 kg), and its inertia values should reflect its mass (see the formula linked above).
@tryan: Please excuse my ignorance because I am NOT a maths guy. Do you take a different formular from that Wiki page depending on the shape you wish to calculate for ? Am I correct in appling the formular you provided me to both the chassis and the wheels ? And lastly, can you recommend a video or article to help me understand the formulae ?
I submitted an answer in response as it allows more characters.