Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: df98de812c24
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5f8c20c95144
Choose a head ref
  • 9 commits
  • 6 files changed
  • 1 contributor

Commits on May 8, 2021

  1. Do not flow a flight plan segment that is before the Ephemeris t_min;…

    … request reanimation instead.
    pleroy committed May 8, 2021
    Copy the full SHA
    207dfbc View commit details

Commits on May 9, 2021

  1. Copy the full SHA
    0584845 View commit details
  2. Copy the full SHA
    6c78908 View commit details
  3. Typos.

    pleroy committed May 9, 2021
    Copy the full SHA
    1b74b89 View commit details
  4. Lint.

    pleroy committed May 9, 2021
    Copy the full SHA
    fdaeb35 View commit details
  5. Copy the full SHA
    da1a70d View commit details

Commits on May 10, 2021

  1. Merge remote-tracking branch 'mockingbirdnest/Grassmannian' into 2975

    # Conflicts:
    #	physics/ephemeris.hpp
    #	physics/ephemeris_body.hpp
    pleroy committed May 10, 2021
    Copy the full SHA
    0f938ee View commit details
  2. Bad merge.

    pleroy committed May 10, 2021
    Copy the full SHA
    c2ab49f View commit details
  3. Merge pull request #2978 from pleroy/2975

    Do not flow a flight plan segment that is before the Ephemeris t_min
    pleroy authored May 10, 2021
    Copy the full SHA
    5f8c20c View commit details
Showing with 46 additions and 11 deletions.
  1. +9 −5 journal/player_test.cpp
  2. +16 −0 ksp_plugin/flight_plan.cpp
  3. +1 −0 ksp_plugin_test/flight_plan_test.cpp
  4. +4 −0 physics/ephemeris.hpp
  5. +13 −2 physics/ephemeris_body.hpp
  6. +3 −4 physics/ephemeris_test.cpp
14 changes: 9 additions & 5 deletions journal/player_test.cpp
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ TEST_F(PlayerTest, DISABLED_SECULAR_Debug) {
// An example of how journaling may be used for debugging. You must set
// |path| and fill the |method_in| and |method_out_return| protocol buffers.
std::string path =
R"(P:\Public Mockingbird\Principia\Crashes\2931\JOURNAL.20210330-124441)"; // NOLINT
R"(P:\Public Mockingbird\Principia\Crashes\2975\JOURNAL.20210507-185451)"; // NOLINT
Player player(path);
int count = 0;
while (player.Play(count)) {
@@ -107,17 +107,21 @@ TEST_F(PlayerTest, DISABLED_SECULAR_Debug) {
serialization::Method method_in;
{
auto* extension = method_in.MutableExtension(
serialization::CatchUpLaggingVessels::extension);
serialization::DeserializePlugin::extension);
auto* in = extension->mutable_in();
in->set_plugin(2109308527968);
in->set_serialization("");
in->set_deserializer(2142487540208);
in->set_plugin(0);
in->set_compressor("gipfeli");
in->set_encoder("base64");
}
serialization::Method method_out_return;
{
auto* extension = method_out_return.MutableExtension(
serialization::CatchUpLaggingVessels::extension);
serialization::DeserializePlugin::extension);
}
LOG(ERROR) << "Running unpaired method:\n" << method_in.DebugString();
CHECK(RunIfAppropriate<CatchUpLaggingVessels>(
CHECK(RunIfAppropriate<DeserializePlugin>(
method_in, method_out_return, player));
#endif
}
16 changes: 16 additions & 0 deletions ksp_plugin/flight_plan.cpp
Original file line number Diff line number Diff line change
@@ -345,6 +345,14 @@ Status FlightPlan::BurnSegment(
not_null<DiscreteTrajectory<Barycentric>*> const segment) {
Instant const final_time = manœuvre.final_time();
if (manœuvre.initial_time() < final_time) {
// Make sure that the ephemeris covers the entire segment, reanimating and
// waiting if necessary.
Instant const starting_time = segment->back().time;
if (starting_time < ephemeris_->t_min()) {
ephemeris_->RequestReanimation(starting_time);
ephemeris_->WaitForReanimation(starting_time);
}

if (manœuvre.is_inertially_fixed()) {
return ephemeris_->FlowWithAdaptiveStep(
segment,
@@ -368,6 +376,14 @@ Status FlightPlan::BurnSegment(
Status FlightPlan::CoastSegment(
Instant const& desired_final_time,
not_null<DiscreteTrajectory<Barycentric>*> const segment) {
// Make sure that the ephemeris covers the entire segment, reanimating and
// waiting if necessary.
Instant const starting_time = segment->back().time;
if (starting_time < ephemeris_->t_min()) {
ephemeris_->RequestReanimation(starting_time);
ephemeris_->WaitForReanimation(starting_time);
}

return ephemeris_->FlowWithAdaptiveStep(
segment,
Ephemeris<Barycentric>::NoIntrinsicAcceleration,
1 change: 1 addition & 0 deletions ksp_plugin_test/flight_plan_test.cpp
Original file line number Diff line number Diff line change
@@ -99,6 +99,7 @@ class FlightPlanTest : public testing::Test {
SymmetricLinearMultistepIntegrator<QuinlanTremaine1990Order12,
Position<Barycentric>>(),
/*step=*/10 * Minute));
ephemeris_->Prolong(t0_ - 2 * π * Second);
navigation_frame_ = std::make_unique<TestNavigationFrame>(
ephemeris_.get(),
ephemeris_->bodies().back());
4 changes: 4 additions & 0 deletions physics/ephemeris.hpp
Original file line number Diff line number Diff line change
@@ -199,6 +199,10 @@ class Ephemeris {
// |desired_t_min|.
void RequestReanimation(Instant const& desired_t_min);

// Blocks until the |t_min()| of the ephemeris is at or before
// |desired_t_min|.
void WaitForReanimation(Instant const& desired_t_min);

// Creates an instance suitable for integrating the given |trajectories| with
// their |intrinsic_accelerations| using a fixed-step integrator parameterized
// by |parameters|.
15 changes: 13 additions & 2 deletions physics/ephemeris_body.hpp
Original file line number Diff line number Diff line change
@@ -359,7 +359,7 @@ Status Ephemeris<Frame>::last_severe_integration_status() const {
}

template<typename Frame>
Status Ephemeris<Frame>::RequestReanimation(Instant const& desired_t_min) {
void Ephemeris<Frame>::RequestReanimation(Instant const& desired_t_min) {
bool must_restart;
{
absl::MutexLock l(&lock_);
@@ -386,7 +386,18 @@ Status Ephemeris<Frame>::RequestReanimation(Instant const& desired_t_min) {
}

template<typename Frame>
void Ephemeris<Frame>::Prolong(Instant const& t) {
void Ephemeris<Frame>::WaitForReanimation(Instant const& desired_t_min) {
auto desired_t_min_reached = [this, desired_t_min]() {
lock_.AssertReaderHeld();
return t_min_locked() <= desired_t_min;
};

absl::ReaderMutexLock l(&lock_);
lock_.Await(absl::Condition(&desired_t_min_reached));
}

template<typename Frame>
Status Ephemeris<Frame>::Prolong(Instant const& t) {
// Short-circuit without locking.
if (t <= t_max()) {
return Status::OK;
7 changes: 3 additions & 4 deletions physics/ephemeris_test.cpp
Original file line number Diff line number Diff line change
@@ -1129,10 +1129,9 @@ TEST(EphemerisTestNoFixture, Reanimator) {
ephemeris2->RequestReanimation(t_initial);

// Wait for reanimation to happen.
while (t_initial < ephemeris2->t_min()) {
LOG(ERROR) << "Sleeping until Herbert West is done...";
std::this_thread::sleep_for(500ms);
}
LOG(ERROR) << "Waiting until Herbert West is done...";
ephemeris2->WaitForReanimation(t_initial);
LOG(ERROR) << "Herbert West is finally done.";
ephemeris2->Prolong(t_final);

// Check that the two ephemerides have the exact same trajectories.