Skip to content

Lamont endpoints #1729

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

Merged
merged 25 commits into from
Mar 1, 2018
Merged

Lamont endpoints #1729

merged 25 commits into from
Mar 1, 2018

Conversation

eggrobin
Copy link
Member

@eggrobin eggrobin commented Feb 18, 2018

Introducing an external API. 🚕

Feature request: #1659.

Currently untested, and one of the functions is unimplemented, however @lamont-granquist has at least been able to find it by reflection. Let us get this in master so that it does not get broken by other changes.

We should add a way to marshal a string within a returned struct; currently the status has no error message.

@@ -340,6 +346,57 @@ message EndInitialization {
optional In in = 1;
}

// These functions form the external API of principia; announce deprecation one
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Principia

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


// This is called "New" because it will eventually construct and release the
// message string. For now it just wraps the error code.
Status NewStatus(base::Status status) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


namespace {

// This is called "New" because it will eventually construct and release the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call in MakeStatus for now. Who knows what it will become once we have proper allocation/deallocation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

u8" planned manœuvres"));
}
// The index of the coast segment following the desired manœuvre.
int const segment_index = manoeuvre_index * 2 + 3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot be odd I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

immobile_reference.Append(coast.Begin().time(),
{reference_position, Velocity<Navigation>{}});
if (coast.Begin() !=
coast.last()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange formatting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, Empty would be more efficient.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or Size.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

reference_position).Norm²() <
(coast.last().degrees_of_freedom().position() -
reference_position).Norm²();
*world_body_centred_nearest_degrees_of_freedom =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

begin_is_nearest

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// These functions form the external API of principia; announce deprecation one
// lunation ahead, then make them return UNIMPLEMENTED.

message ExternalFlowFreefall {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment the messages.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

{-100'000 * Kilo(Metre), 0 * Metre, 0 * Metre})).coordinates() /
Metre),
&result);
EXPECT_THAT(status.error, Eq(static_cast<int>(base::Error::OK)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do the reverse:

EXPECT_THAT(static_cast<base::Error>(status.error), IsOk());

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

auto const barycentric_result =
to_world.Inverse()(FromQP<RelativeDegreesOfFreedom<World>>(result));
// The reference position is far above the apoapsis, so the result is roughly
// the apoapsis.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the apoapsis be deduced from the other parameters, to avoid hard-wiring numbers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not quite the apoapsis, so the test would get complicated. This is easy to understand (and with IsNear, it shouldn't break because of changes in the numerical methods).

Vessel& TestPlugin::AddVesselInEarthOrbit(
GUID const& vessel_id,
std::string const& vessel_name,
PartId part_id,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

SolarSystemFactory::Earth,
/*loaded=*/false,
inserted);
CHECK(inserted);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Print the vessel id and name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

using physics::KeplerianElements;
using physics::SolarSystem;

class TestPlugin : public Plugin {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a short comment for the constructor and the method.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

optional Return return = 3;
}

// Returns first point of the coast phase following the given manoeuvre which is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returns the first

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@pleroy pleroy added the LGTM label Feb 28, 2018
@pleroy
Copy link
Member

pleroy commented Feb 28, 2018

LG, but let's make sure that Jenkins is still happy.

@pleroy pleroy merged commit 1ab55e3 into mockingbirdnest:master Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants