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

wave_geography interface update #293

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

Kaythay
Copy link
Contributor

@Kaythay Kaythay commented Aug 20, 2018

  • replaces arrays of double with Eigen vector/matrices
  • removes Autonomoose headers from wave_geography files
  • fixes documentation generation

Pre-Merge Checklist:

  • Code is documented in doxygen format
  • Code has automated tests
  • Zero compiler warnings
  • Formatted with clang-format

Replaces raw arrays of doubles with Eigen matrices/vectors.
Also updates wave_geography_tests.
Before, the API reference was not properly generated when running `make doc`
Descriptions of the functions already existed, just needed to add
the doxygen tags so that the functions show up in the docs.
@Kaythay Kaythay self-assigned this Aug 20, 2018
@Kaythay Kaythay requested a review from leokoppel August 20, 2018 20:57
Copy link
Contributor

@leokoppel leokoppel left a comment

Choose a reason for hiding this comment

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

Your changes look great!

Just thought of some more improvements to the interface

CMakeLists.txt Outdated
@@ -121,6 +121,7 @@ ADD_SUBDIRECTORY(wave_geography)
# Documentation
SET(WAVE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET(WAVE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
SET(WAVE_MODULES utils geometry containers benchmark controls kinematics matching vision optimization gtsam geography)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see, it's a regression from a previous commit where I deleted the LIBWAVE_MODULES list.

Is it possible to have the WAVE_ADD_MODULE function add to this list instead of writing it out here?

@@ -50,7 +21,21 @@ namespace wave {
* is relative to the WGS84 ellipsoid.
* @param[out] ecef the corresponding point in the geocentric ECEF frame.
*/
void ecefPointFromLLH(const double llh[3], double ecef[3]);
template <typename DerivedA, typename DerivedB>
void ecefPointFromLLH(const Eigen::MatrixBase<DerivedA> &llh,
Copy link
Contributor

@leokoppel leokoppel Aug 20, 2018

Choose a reason for hiding this comment

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

// Compare R's directly
for (int i_row = 0; i_row < 3; ++i_row) {
for (int j_col = 0; j_col < 3; ++j_col) {
EXPECT_NEAR(expected_R_ENU_ECEF[i_row][j_col],
T_ENU_ECEF[i_row][j_col],
EXPECT_NEAR(expected_R_ENU_ECEF(i_row, j_col),
Copy link
Contributor

Choose a reason for hiding this comment

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

You can now use Eigen's isApprox instead of looping over each matrix
Use the MatricesNear test predicate e.g.

EXPECT_PRED2(MatricesNear, (H_combined.block<6, 6>(0, 0)), H_pose);

(actually maybe a MatricesNearPrec is needed, here
https://github.com/wavelab/libwave/blob/master/wave_utils/include/wave/wave_test.hpp#L28 )

double R_ENU_ECEF_result[3][3] = {{0.0, 1.0, 0.0}, //
Eigen::Matrix3d R_ENU_ECEF_result;
R_ENU_ECEF_result << 0.0, 1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0, 1.0;
/*double R_ENU_ECEF_result[3][3] = {{0.0, 1.0, 0.0}, //
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove commented out code

Eigen::Matrix4d T_ecef_enu;
ecefFromENUTransformMatrix(datum, T_ecef_enu, datum_is_llh);

// Affine inverse: [R | t]^(-1) = [ R^T | - R^T * t]
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice this is way shorter than before!

double T_enu_ecef[4][4],
bool datum_is_llh = true);
template <typename DerivedA, typename DerivedB>
void ecefFromENUTransformMatrix(const Eigen::MatrixBase<DerivedA> &datum,
Copy link
Contributor

@leokoppel leokoppel Aug 20, 2018

Choose a reason for hiding this comment

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

Hmm these function interfaces are (already were) really confusing. This may be a good chance to change the names as well..

Whenever I see ecefFromENUTransformMatrix it seems like the function takes an "ENU transform matrix" and returns an "ecef".

It is also confusing to have a parameter datum_is_llh change the meaning of another parameter.

Maybe two separate functions
ecefEnuTransformFromEcef
ecefEnuTransformFromLlh

where the second function does the if (datum_is_llh) code and calls the first

Copy link
Contributor

@leokoppel leokoppel Aug 20, 2018

Choose a reason for hiding this comment

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

Actually if the ecefPointFromLLH function is changed to return the point, there is no need for the second function (where datum_is_llh) at all. The user can just chain the calls, ecefEnuTransformFromEcef(ecefPointFromLLH(x))

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

Successfully merging this pull request may close these issues.

2 participants