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

More elegant return type and tuples #9

Open
rikba opened this issue Jul 6, 2023 · 0 comments
Open

More elegant return type and tuples #9

rikba opened this issue Jul 6, 2023 · 0 comments

Comments

@rikba
Copy link
Contributor

rikba commented Jul 6, 2023

Somehow, for the radar return type you can have a very elegant way of selecting the Radar object among the result tuple. See https://github.com/ethz-asl/mav_sensors/blob/master/src/impl/radar/xwr18xx_mmw_demo.cpp#L96-L99

  std::get<Radar>(measurement).cfar_detections.resize(num_detected_obj);
  std::get<Radar>(measurement).unix_stamp_ns =
      std::chrono::duration_cast<std::chrono::nanoseconds>(now.time_since_epoch()).count();
  std::get<Radar>(measurement).hardware_stamp = time_cpu_cycles;

However, the same does not seem to work for Temperature and Pressure. Would be nice to do for example

    auto measurements = bmp390.read();
    LOG(I, std::get<FluidPressure>(measurements).has_value(),
        "Pressure: " << std::get<FluidPressure>(measurements).value() << " Pa");

instead of selecting by index, as this can lead to wrong indexing, see https://github.com/ethz-asl/mav_sensors/blob/master/src/main.cpp#L24C1-L35

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

No branches or pull requests

1 participant