If your Pikmin have wandered off, you can press the A button near the S.S. Drake (your home base), which orders Pikmin to come back to the Onion. You'll need to watch out for dangerous creatures and other obstacles as they make their way back, but this tip can be a helpful way to ensure your stray Pikmin aren't eaten by creatures when night falls.