Page 1 of 1

Physics error for wheel with TORQUE_CONTROL

Posted: Mon Jan 18, 2021 11:06 am
by lehnertu
I'm trying to simulate a robot balancing on two wheels.
I want to use TORQUE_CONTROL for driving the wheels, because the torque is what I set when
setting the PWM on a real motor controller. I was able to do a control loop that stabilizes my robot.

But the final state does not capture the correct physics. The robot is standing at a fixed place
leaning to one side and applies torque to its wheels to counteract the gravity force that wants to tip it over.
The wheels are spinning so the friction between the wheels and the plane just balances the torque.
This should never be a stationary state! The robot must accelerate to the side - it doesn't !
It stands still leaning 5 degrees to one side!
pybullet_error.png
pybullet_error.png (184.8 KiB) Viewed 2312 times

Interestingly, it works with VELOCITY_CONTROL, only the toque jumps all over the place.

The URDF snippet descibes one wheel:

Code: Select all

  <link name="right_wheel">
    <visual>
      <geometry>
        <cylinder length="1.0" radius="3.5"/>
      </geometry>
      <origin rpy="0 1.57 0" xyz="0 0 0"/>
      <material name="red"/>
      <origin rpy="0 0 0" xyz="0 0 0"/>
    </visual>
    <collision>
      <geometry>
        <cylinder length="1.0" radius="3.5"/>
      </geometry>
      <origin rpy="0 1.57 0" xyz="0 0 0"/>
    </collision>
    <contact>
      <lateral_friction value="0.5"/>
      <rolling_friction value="0.01"/>
      <stiffness value="100000"/>
      <damping value="3000"/>
    </contact>
  </link>