I’m using a compass with the robot and when the motors are running, they generate magnetic field around them, which affects the performance of the compass. Is there a way to shield the magnetic field generated by the motors using materials which I can find around the house? (Or any general easy solution)
That will take a while - So it will wait until later Several things you said are almost correct…
Magnetic fields are not stopped by anything as far as I know. I think that they extend to infinity from their source. But… their strength falls off rapidly (with the cube of distance in free space).
To get the field strength to fall off even faster, you can surround the field source with something other than free space. There are special materials that are good for this.
Look for something called MuMetal (I forget how to spell it). It is an alloy that works better than plain old iron or steel. By helping to concentrate/guide much of the flux in a field, a MuMetal case does help lower the strength of that field outside of the case.
However, trying to use a magnetic compass on a metal Vex robot that uses electric motors and gives the compass a realtively rough ride, might simply be fighting a losing battle. Think hard about whether you can use either a different sensor or a different way to transport it.