Go back home routine on input Start Program

Hello, what is the recommended procedure to start the program with external button?
Now after first push of a button robot goes to Home position without asking anything. After second push program starts. What if the path home is not collision free?

I suppose, that at the start of the program I should check if robot is in Home. If not, then don’t go there if it is not safe. Am I right or is there a simpler solution to this?

I think the procedure is very dependent on the application, and the restrictions that you have in the workspace.
But a basic approach is described in this article.