I need to fly from one orbit to another to dock with station. So, station should be near the my position when I arrive to it's orbit.
I can find the station's position at time T, but how to find this time T?
I can calculate time for travel to start maneuver point plus time to travel station orbit, which gives me a future position, but flying to this position gives me another time, which gives another position, etc...
So, how to deal with it?
I heard about Lambert's problem. I found the working code that calculates needed theta angle, V1 and V2 using r1, r2, mu and needed t by Lambert's problem solver (Solver github.com/esa/pagmo/blob/master/src/AstroToolbox/Lambert.cpp). But I'm not sure that this is a thing that I'm seeking. How to find that time t of transfer? Should I use the time of Hohmann transfer from one orbit to another? And then just wait for returned theta angle before start the maneuver? Is it working only for circular orbits? What if I need to dock with station on Halo orbit?
This function returns needed angle for transfer by given time. But I need function that return transfer time by given current angle.
I don't know how to solve this kind of problems. I have two spacecrafts on different orbits with some random angle difference and I want that one spacecraft flied to orbit of another to the same location where another will be at arrival time. I don't need pork chop plot I just need a time and point where we will meet. I can perfectly predict position of any spacecraft at any time, but I don't know the time.
Update: this lambert's solver is not working (or I'm using the given velocities wrong, or my ship changes current velocity to needed for too much time when given velocity can be invalid already)