Migrating to the new Gazebo, Questions about physics, surface, and contacts

Hello,

I have finally migrated my robots simulation package to the new gazebo (harmonic) and it works really nicely now. My purpose is to make a world with friction and slipping, so odometer will produce the wrong results, and with the imu data and the EKF plugin, the odometry is corrected.
(I have this done using gazebo classic)

I have some questions:

For a wheel can we use:

    <surface>
        <friction>
            <ode>
                <mu>0.7</mu>
                <mu2>150</mu2>
                <fdir1>0 1 0</fdir1>
            </ode>
        </friction>
        <contact>
          <ode>
            <soft_cfm>0</soft_cfm>
            <soft_erp>0.2</soft_erp>
            <kp>5e+5</kp>
            <kd>1</kd>
            <max_vel>0.01</max_vel>
            <min_depth>0.001</min_depth>
          </ode>
        </contact>
        <max_contacts>20</max_contacts>
    </surface>

How can we experimentally (in simulation) the fdir is correct? Within the new gazebo, are the contact → ode parameters such as soft_cfm soft_erp kd … supported.

Second question: I the previous gazebo I have done this trick with the worlds ground plane. Should it be possible or required to do it in the new gazebo:

    <collision name='ground_plane_collision'>
      <geometry>
        <plane>
          <normal>0 0 1</normal>
          <size>20 20</size>
        </plane>
      </geometry>
      <surface>
        <contact>
          <collide_bitmask>65535</collide_bitmask>
          <ode/>
        </contact>
        <friction>
          <ode>
            <mu>10</mu>
            <mu2>5</mu2>
          </ode>
          <torsional>
            <ode/>
          </torsional>
        </friction>
        <bounce/>
      </surface>
      <max_contacts>10</max_contacts>
    </collision>

Here is the repository with the worlds: rosrider_gz/rosrider_gz_gazebo/worlds at main · acadadev/rosrider_gz · GitHub

I basically have to create a more realistic environment with regard to friction. Also, the diff_drive_plugin in the new gazebo uses coordinaes from world, and not the encoder, this also will have to be solved.

I have everything working, only not sure if the are right, and the simulation is adressing friction parameters.

Any ideas, reccomendations and help greatly appreciated.

Best Regards,

-C.A.

I have downloaded the source tree for gz-sim, and upon inspection found out that DiffDriveOdometry.cc is used to calculate odometry data, based on wheel positions. In classic gazebo diff-drive-plugin, if the odometry source is set to WORLD, it will get it from gazebo, and if odometry source is set to ENCODER it will calculate it based on joint positions. The new gazebo’s DiffDrive system, (hidden away in gz_math) does indeed calculate based on joint positions, therefore by default it is based on ENCODER, and there is also no code to get it from world neither. However even though I have introduced slipping, the odometry still outputs perfect result.