Skip to content

Commit

Permalink
Fuck this
Browse files Browse the repository at this point in the history
  • Loading branch information
S010MON committed Jun 21, 2021
1 parent 2a4f04f commit 306e02f
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions app/src/main/java/src/land/ClosedLoopController.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

public class ClosedLoopController extends LandingController
{

private final Vector3d MAX_BURN = new Vector3d(10,0,0);
private double burnHeight = 500;
private Vector3d burn = new Vector3d(5,0,0);

public ClosedLoopController()
{
Expand All @@ -18,14 +17,28 @@ public ClosedLoopController()
@Override
protected State controllerAction(State currentState, double planetRadius)
{

if(testHeight(currentState, planetRadius + burnHeight))
{
currentState.velocity.set(0, currentState.velocity.get(0).add(burn));
double angle = getAngleFromState(currentState);
if( angle < 30)
{

}
else if (angle > 330)
{

}

currentState.velocity.set(0, currentState.velocity.get(0).add(MAX_BURN));
}
return currentState;
}

private double getAngleFromState(State state)
{
return getAngle(state.velocity.get(0), state.position.get(1), state.position.get(0));
}

public double getAngle(Vector3d velocity, Vector3d landLocation, Vector3d probeLocation)
{
double a = distance(landLocation,velocity);
Expand All @@ -34,6 +47,16 @@ public double getAngle(Vector3d velocity, Vector3d landLocation, Vector3d probeL
double cosA = cosineLaw(a,b,c);
return cosA;
}

private Vector3d scaleBurn(Vector3d velocity)
{
if(Math.abs(velocity.norm()) > Math.abs(MAX_BURN.norm()))
return MAX_BURN;

double percentage = Math.abs(MAX_BURN.norm()) - Math.abs(velocity.norm());
return null;
}


private double cosineLaw(double a, double b, double c)
{
Expand Down

0 comments on commit 306e02f

Please sign in to comment.