Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinpoint Landing #41

Open
brunopinto900 opened this issue Aug 18, 2022 · 2 comments
Open

Pinpoint Landing #41

brunopinto900 opened this issue Aug 18, 2022 · 2 comments

Comments

@brunopinto900
Copy link

Hello,

Me and my colleagues want to implement several algorithms to land a spacecraft on the ground, GFOLD is one of the solutions. Is this possible with the current state of this repo?

Thank you.

@rslippert
Copy link

rslippert commented Feb 18, 2024

? Did Alfonso ever responded to this ?
I would say; No, the CR3BP.py code does not have mass or the ability to thrust.
It looks like this code assumes zero mass. But it should be easy to modify.

You will need to add mass like Alfonso did with Spacecraft.py
For thrust you need to add acceleration terms into states 3,4,5 of the of diffy_q() function

def diffy_q( self, et, state ):
	rx, ry, rz, vx, vy, vz, mass = state

	r13_vec = [ rx + self.mu, ry, rz ]        # vector barycenter - Earth
	r23_vec = [ rx - 1 + self.mu, ry, rz ]    # vector barycenter - moon
	r13_3   = np.linalg.norm( r13_vec ) ** 3
	r23_3   = np.linalg.norm( r23_vec ) ** 3
	omega_x = rx - self.one_mu * ( rx + self.mu ) / r13_3 -\
				self.mu * ( rx - 1 + self.mu ) / r23_3
	omega_y = ry - self.one_mu * ry / r13_3 - self.mu * ry / r23_3
	omega_z = -self.one_mu * rz / r13_3 - self.mu * rz / r23_3
	state_dot       = np.zeros( 7 )
	state_dot[ :3 ] = [ vx, vy, vz ]
	accel, mdot, a_mag = self.thruster( et, mass ) # get rocket thrust scalars
	state_dot[  3 ] =  2 * vy + omega_x + accel[0]
	state_dot[  4 ] = -2 * vx + omega_y + accel[1]
	state_dot[  5 ] = 			omega_z + accel[2]
	state_dot[ 6  ] = mdot
	return state_dot

then the thruster ( thrust to accel and mdot) looks like this_:

def thruster( self, et, mass ): #  Thrust at time
	T_mag = np.linalg.norm( self.thrust )  # thrust magnitude (N)
	self.T_mag = T_mag
	mdot = -T_mag / (self.impulse[0] * 9.80665)*EM['Time_K'] # fuel flow kg/EMsec
	ax = EM['Accel_K'] * self.thrust[0]/mass  # CR3BP acceleration
	ay = EM['Accel_K'] * self.thrust[1]/mass
	az = EM['Accel_K'] * self.thrust[2]/mass
	if self.fuel < 0.5: # if out of fuel
		return( [0.,0.,0.], 0., 0.)  # return no acceleration
	A_mag = np.linalg.norm( [ax,ay,az ] ) # acceleration magnitude m/sec2
	return( [ ax, ay, az], mdot, A_mag) #return accel due to thrust

EM={'lunar_r' : 1737.4, # mean radius of moon km
'earth_r' : 6371, # mean radius of Earth
'NRHO_period' : 6.531, # days for 1 Gateway orbit
'NRHO_Jacobi' : 3.047, # jacobi const of Gateway orbit
'Dist_K' : 384400., # Distance km in 1 EMBR_dist constant
'Time_K' : 375700., # Seconds in 1 EMBR_time constant
'days_K' : 4.348378, # Days in 1 EMBR_time constant
'Vel_K' : 1023.157, # m/sec orbital velocity of moon 1000*Dist_K/Time_K
'Accel_K': 367.201, # Time_K / Vel_K
'lunar_sid': 27.32167, # days for 1 lunar sidereal rotation (earth rel.)
'lunar_syn': 29.53059, # days for 1 lunar synodic phases (solar rel.)
'lunar_vel' : 1023.157, # lunar velocity m/sec RL
'mu': 0.0121505844, # Earth Moon combined gravity parameter
'lunarX': 0.98784638, # EMBR X location of moon
'L1': 0.8362925909457, # location L1 EMBR
'L2': 1.1561681659055, # location L2 EMBR
'L3':-1.0051155116069, # location L3 EMBR
'mass2':7.34578765e22, # mass of Moon
'mass1':5.9721671e24 # mass of Earth
}

@rslippert
Copy link

rslippert commented Mar 9, 2024

BTW
I will be releasing Gateway24 software includes Spacecraft mass,fuel plus moon landing.
Gateway24 switches from CR3BP to Kepler style differential equations for landing on moon.
For landing, a 14 state, 6DOF state vector is needed,
An example TVC python github code is natronimo
search for "tvc simulation python mass thrust vector"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants