The error you encountered while running the example is likely due to a failure during the installation of all module code, which caused the example code to produce an error.
If you are installing a system with a desktop environment, you do not need to execute the following commands (as shown):
sudo apt install git python3-pip python3-setuptools python3-smbus
These commands are only required for the Lite system.
Directly download and install the code for the robot-hat, vilib, and pidog modules. If you encounter any error messages during the installation process, please provide the complete error information so that we can help you analyze and resolve the issue.
Once all module code is successfully installed, try running the example code again to see how it works.