external power supply corrupts servo signal

Hello, I am running a program on an arduino uno that outputs a servo PWM signal to emulate an
RC receiver in order to control a drone (through the Ardupilot Mega). For now, I am just using the servo sweep example.

The ardupilot mega interprets the signal flawlessly when the arduino uno
is powered through USB connection from the computer, however the signal
appears to be filtered out when the arduino is powered from another
power supply (I tried a 9v battery, a 12v power adapter and a 5v usb power adapter).

What is really strange is that If the the arduino is powered from a 9v power supply, and the
usb cable is plugged into the arduino usb port (but not the computer),
that makes the signal quite a bit clearer but it still does not work consistently.

I need to power the arduino from a battery. Does anyone know what it might be about the USB connection from the
computer as a power source that causes the servo signal from the arduino
to be cleaner? Is there something else that might be causing this problem?

This sounds like a grounding problem. Are you connecting all the relevant grounds together?

Thanks a lot, that fixed it.