Arduino acts odd when disconnected from computer I'm building an self-navigating robot with an arduino, an ultrasonic sensor, and two DC motors. I'm currently within the process of coding the robot but I've discovered I have an unusual problem; whenever I run the project via the USB cable operations run fine, however once I take the cable out and run the system on batteries alone performance diminishes.

I have checked the code thoroughly, however I don't understand how this could be an issue that's coding related. I also (as part of the testing) built a basic program which only operated the motors, and was able to run this via USB and via batteries alone with no difference in performance.

So what possible reasons could there be for a drop in performance? I have included a link to a youtube video I had taken of it earlier below to maybe give a better understanding of how performance diminishes:

https://youtu.be/Tp5LtOKBKHw

(Also it could be important to note if I take the cable out while motors are currently moving performance stays at where it should be)

Thanks!
What seems is that you are facing an power shortage while working with on board power supply.
While running DC motors and Arduino on same battery set your Arduino is not getting enough power.

Try switching to a better power supply which can maintain a constant EMF, as eventually you'll always run out of power.
Try an adaptor to use wall socket current.
This way you'll not lose any functionality of Arduino project.