Cartesian cran and a robot


I have a setup like this:

A cartesian cran moving a robot arm.

I am wondering how to make a program that moves the cartesian cran, such that the robot arm reaches its points. I cind of wants to jog the hole thing togheter. Do you understand my vision?