Jump to content

Rendezvous Calculations


alpha tech

Recommended Posts

For a while I have been trying to figure out how to calculate when two space crafts will intersect each other and have come up with nothing so I was wondering if anybody else has figured it out?

If you want to know why I'm thinking of a challenge to rendezvous an dock with another spacecraft without using map mode

Link to comment
Share on other sites

I had to figure it all out (with a lot of referring to online resources and other people's efforts) for my kOS scripts. I've automated rendezvous from launch to taking up station 25m away from the target. I found matching inclination the hardest part to get my head around. Once you've matched inclination and know that the to orbits intersect somewhere, it's all a matter of timing. I don't see how you'd do all this without mods that supply additional information about your orbit and that of the target (KER, Mechjeb, etc.) or else just using a huge amount of delta-v to brute force it.

Link to comment
Share on other sites

On 10/08/2016 at 1:11 AM, ElWanderer said:

I had to figure it all out (with a lot of referring to online resources and other people's efforts) for my kOS scripts. I've automated rendezvous from launch to taking up station 25m away from the target. I found matching inclination the hardest part to get my head around. Once you've matched inclination and know that the to orbits intersect somewhere, it's all a matter of timing.

Here's the launch angle (azimuth) calculation. http://www.orbiterwiki.org/wiki/Launch_Azimuth

This will get you very close to the target inclination.

The next trick in actually the launch time, which is actually an offset from the wiki formula.

I take this as :-    Launch base longitude  - (Time to orbit / 2),  but it varies a bit depending on the rocket, parking orbit height.. etc.

but I've settled on 8 minutes to orbit so subtract/add 240 seconds to the launch time.

Once in parking orbit you're still not accurate enough, so now have to make in-flight corrections to match Inclination and LAN.

Inclination corrections are done at Ascending and Decending nodes on the earths equator, and LAN corrections are done at the most Northerly  and Southerly Latitude points of the orbit.

You should have this all wrapped up within 2 orbits (1 orbit if your launch is good).

 

From here it's a matter of timing, and doing orbit burns at the target apsides will help with accuracy.

I'm still testing Orbit times when I last left this... will get back to it sometime..

This is as far as I've got that works... https://www.dropbox.com/s/v6ec9xoila6sw6z/ISS1_A.mp4?dl=0

//******************************************************************************
//								CALCULATE LAUNCH ANGLE
//******************************************************************************
Function Stg0_ShipLaunchAngle
{
Local V_Orb is 0.
Local V_xrot is 0.
Local V_yrot is 0.
Local f_TmpA is 0.
Local f_TmpB is 0.

	Set b_INC_Reduction to FALSE.											//
	Set f_TmpA to ABS(BASE_LAT).                                        	//
	IF Targ_Inc > f_TmpA													// INCLINATION limitation
	{                                                                   	//
		Set f_TmpB to ARCSIN(COS(Targ_Inc)/COS(f_TmpA)).					// Desired angle at Base Latitude
		Set V_Orb to SQRT(LUNARS:Mu/(LUNARS:Radius + ParkingOrbit)).		// End Maneuver velocity (orbit insertion)
		Set V_xrot to (V_Orb * SIN(f_TmpB)) - (465.9 * COS(f_TmpA)).		// X-velocity component minus surface velocity at latitude.
		Set V_yrot to (V_Orb * COS(f_TmpB)).								// Y-valocity component.
		Set f_TmpA to ARCCOS(COS(f_TmpB)/SIN(Targ_Inc)).					// Asc Node to Base longitudes.
		Set f_TmpB to ARCTAN(V_xrot/V_yrot).								// Launch angle
		IF b_AscNode = TRUE													// Ascending node launch
		{                                                               	//
			IF 	f_TmpB < 0 {Set f_TmpB to f_TmpB + 360.}                	//
			IF BASE_LAT > 0                                             	//
			{                                                           	//
				Set Ship_LAUNCHLong to (BASE_LONG - f_TmpA).            	//
			}                                                           	//
			ELSE                                                        	//
			{                                                           	//
				Set Ship_LAUNCHLong to (BASE_LONG + f_TmpA).            	//
			}                                                           	//
		}                                                               	//
		ELSE																// Descending node launch
		{                                                               	//
			Set f_TmpB to 180 - f_TmpB.                                 	//
			IF 	f_TmpB < 0 {Set f_TmpB to f_TmpB + 360.}                	//
			IF BASE_LAT < 0                                             	//
			{                                                           	//
				Set Ship_LAUNCHLong to (BASE_LONG - f_TmpA).            	//
			}                                                           	//
			ELSE                                                        	//
			{                                                           	//
				Set Ship_LAUNCHLong to (BASE_LONG + f_TmpA).            	//
			}                                                           	//
		}                                                               	//
		Set Ship_LaunchHead to f_TmpB - 0.9.                            	//
		IF Ship_LAUNCHLong < 0 { Set Ship_LAUNCHLong to Ship_LAUNCHLong + 360.}
		IF Ship_LAUNCHLong > 360 { Set Ship_LAUNCHLong to Ship_LAUNCHLong - 360.}

		Set DDINC to ABS(Ship_LaunchHead - (90 - Targ_Inc)).				//
		IF DDINC > 10 {Set DDINC to 360 - DDINC.}                       	//
		Set DDINC to DDINC/5.                                           	//

		// FIRST SHIP GOES DIRECT TO 400KM.                             	//
		IF b_Targ = FALSE {Set ParkingOrbit to Targ_StationHgt.}			//
	}
	ELSE	//If Target inclination is below base latitude flag it and launch at 90
	{
		Set b_INC_Reduction to TRUE.										//
		Set Ship_LaunchHead to 90.                                      	//
	}                                                                   	//
}
//******************************************************************************
//							DETERMINES LAUNCH TIME
//******************************************************************************
Function Stg0_PreLaunch_Longitude
{
Local tmpTime is 0.0.
local m_Wop is 0.

	Set Targ_LanLong to (Targ_Lan - Ship:ORBIT:BODY:ROTATIONANGLE).			// Current Longitude
	IF Targ_LanLong < 0 {Set Targ_LanLong to 360 + Targ_LanLong.}			// Bounds check
	IF Targ_LanLong > 360 {Set Targ_LanLong to Targ_LanLong - 360.}	

	Set TtoLaunch to Targ_LanLong - Ship_LAUNCHLong.						// Launch on Ascending node at the moment.
	Set TtoLaunch to TtoLaunch - 1.											// - 240 seconds (LaunchTime/2)
	IF TtoLaunch < 0 {Set TtoLaunch to 360 + TtoLaunch.}					// Bounds check
	IF TtoLaunch > 360 {Set TtoLaunch to TtoLaunch - 360.}					//
	Set TtoLaunch to TtoLaunch * 240.										// Convert Long to seconds

	If ABS(TtoLaunch) < 5													// Start launch sequence at 5 seconds
	{                       												//

		Return TRUE.        												// Flag time to start
	}                       												//
	ELSE
	{                       												// We only do this when out of Countdown
		IF TtoLaunch < 20 {Set WARP to 0.}                                  // 'Warp Factor X Commander Data'
		ELSE IF TtoLaunch < 50 {Set WARP to 1.}                            	//
		ELSE IF TtoLaunch < 500 {Set WARP to 2.}                           	//
		ELSE IF TtoLaunch < 2000 {Set WARP to 3.}                           //
		ELSE {Set WARP to 4.}                                               //
		Return FALSE.       												// Don't start yet
	}                       												//
}

}

Edited by ColKlonk2
Link to comment
Share on other sites

On 8/9/2016 at 1:41 PM, alpha tech said:

For a while I have been trying to figure out how to calculate when two space crafts will intersect each other and have come up with nothing so I was wondering if anybody else has figured it out?

The family of equations this leads to cannot be solved analytically in general form. It's a significant limitation of orbital mechanics and central potentials in general.

This has to be solved numerically. If you know anything about programming, it's relatively easy to learn methods that will let you solve simple cases, like orbit-to-orbit transfers. If you don't, and you still want to be able to do it, you'll have to learn that first.

Link to comment
Share on other sites

It's easier to get your Inclination and LAN as accurate as possible from launch.

From there it's a minor Dv expense to make final adjustments in a lower 'parking orbit'.

As we're working with KOS + KSP's idea of real time processing... I've taken the lower altitude route.

From a lower altitude you work out the comparative orbit times between your ship and the target at every target apside.

And all you do is fire prograde (at apsides) until the times intersect within a few 100 metres.

From there you use vector maths to dock.

 

I'm still looking at over/undershoot wrt orbits, but have no time at the mo.

As K^2 says... numerical maths.

This is nothing more than having a program loop, that branches out to other procedures, that services events.

In KSP/KOS we have no choice but to hope for the best.. that our sh't works the way it should work in RL.

It might be an idea to implement 'averaging' into one's calcs... downright pain, but is a necessity wrt to KSP/KOS

Talk about a pain killer

:wink:

Edited by ColKlonk2
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...