There exists many algorithms (and libraries but mostly in C++ and Java) that address this kind of problem but basically the idea is always the same, consider the set of acceptable positions of your robots (based on obstacles, self intersection and joint limits) aka, the free space, and move through this set from your current position to the position you want to go to.