At many instance in Fallout 4, player's companion is no where to be found, I personally landed in a tough situation where i was required the help of Dogmeat but he was nowhere to be seen. Thankfully, there is a way to get them back and the guide below explains you how to recover your lost companion: Dogmeat, Piper and others.
To get back your companions just type in the following in the console.
"prid (then the ref ID. For example, 00002f1f to get Piper)
moveto player"
For Dogmeat the steps will be:
For Piper the steps will be:
Please Note: Not all base ID has been discovered, there are still many left for other companions. I will keep updating this post as soon as I discover more. Stay tuned. Did you know base ID for other companions? Let us know in the comment section below.