@Test @Ignore public void stagnate_acceleration() throws Exception { Assert.assertEquals("We should keep the same acceleration if we do not accelerate", new D3Vector(0, 0, 0), engine.stagnate_acceleration(new D3Vector(0, 0, 0))); Assert.assertEquals("When we exceed the 90% mark of velocity, then we should limit the accelaration to 75% of the original acceleration.", current_acceleration.scale(0.25), engine.stagnate_acceleration(new D3Vector(1, 1, 1))); }
public D3Vector stagnate_acceleration(D3Vector input) { D3Vector output = input; if (m_gps.getVelocity().length() >= (Settings.MAX_DRONE_VELOCITY * 0.9)) { double maxAcceleration = Settings.MAX_DRONE_VELOCITY - m_gps.getVelocity().length(); if (output.length() > Math.abs(maxAcceleration)) { output = output.scale(maxAcceleration / output.length() == 0 ? 1 : output.length()); } } return output; }
Engine { public D3Vector stagnate_acceleration(D3Vector input) { D3Vector output = input; if (m_gps.getVelocity().length() >= (Settings.MAX_DRONE_VELOCITY * 0.9)) { double maxAcceleration = Settings.MAX_DRONE_VELOCITY - m_gps.getVelocity().length(); if (output.length() > Math.abs(maxAcceleration)) { output = output.scale(maxAcceleration / output.length() == 0 ? 1 : output.length()); } } return output; } }
Engine { public D3Vector stagnate_acceleration(D3Vector input) { D3Vector output = input; if (m_gps.getVelocity().length() >= (Settings.MAX_DRONE_VELOCITY * 0.9)) { double maxAcceleration = Settings.MAX_DRONE_VELOCITY - m_gps.getVelocity().length(); if (output.length() > Math.abs(maxAcceleration)) { output = output.scale(maxAcceleration / output.length() == 0 ? 1 : output.length()); } } return output; } Engine();  Engine(Publisher m_publisher, GPS m_gps, DroneInit m_drone, D3Vector lastAcceleration); }
Engine { public D3Vector stagnate_acceleration(D3Vector input) { D3Vector output = input; if (m_gps.getVelocity().length() >= (Settings.MAX_DRONE_VELOCITY * 0.9)) { double maxAcceleration = Settings.MAX_DRONE_VELOCITY - m_gps.getVelocity().length(); if (output.length() > Math.abs(maxAcceleration)) { output = output.scale(maxAcceleration / output.length() == 0 ? 1 : output.length()); } } return output; } Engine();  Engine(Publisher m_publisher, GPS m_gps, DroneInit m_drone, D3Vector lastAcceleration); D3Vector getLastAcceleration(); static D3Vector limit_acceleration(D3Vector input); static D3Vector maximize_acceleration(D3Vector input); D3Vector stagnate_acceleration(D3Vector input); void changeAcceleration(D3Vector input_acceleration); D3Vector changeVelocity(D3Vector input); final void registerCallback(EngineCallback callback); }
Engine { public D3Vector stagnate_acceleration(D3Vector input) { D3Vector output = input; if (m_gps.getVelocity().length() >= (Settings.MAX_DRONE_VELOCITY * 0.9)) { double maxAcceleration = Settings.MAX_DRONE_VELOCITY - m_gps.getVelocity().length(); if (output.length() > Math.abs(maxAcceleration)) { output = output.scale(maxAcceleration / output.length() == 0 ? 1 : output.length()); } } return output; } Engine();  Engine(Publisher m_publisher, GPS m_gps, DroneInit m_drone, D3Vector lastAcceleration); D3Vector getLastAcceleration(); static D3Vector limit_acceleration(D3Vector input); static D3Vector maximize_acceleration(D3Vector input); D3Vector stagnate_acceleration(D3Vector input); void changeAcceleration(D3Vector input_acceleration); D3Vector changeVelocity(D3Vector input); final void registerCallback(EngineCallback callback);  }