Probably we are following the Gazebo SIM tutorial “Moving the robot” and added this plugin config to your XML file:

<plugin
filename="gz-sim-diff-drive-system"
name="gz::sim::systems::DiffDrive">
<left_joint>left_wheel_joint</left_joint>
<right_joint>right_wheel_joint</right_joint>
<wheel_separation>1.2</wheel_separation>
<wheel_radius>0.4</wheel_radius>
<odom_publish_frequency>1</odom_publish_frequency>
<topic>cmd_vel</topic>
</plugin>

And you received this error message:

[Err] [DiffDrive.cc:185] DiffDrive plugin should be attached to a model entity. Failed to initialize.

Initially you could think that DiffDrive plugin wasn’t found, but that is not the case.

This error happens because you put the plugin inside the “<world ” section! In fact the plugin should be put inside your vehicle “<model ” section.