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

New variance field for the Range message #1270

Closed
ejalaa12 opened this issue Mar 13, 2023 · 8 comments
Closed

New variance field for the Range message #1270

ejalaa12 opened this issue Mar 13, 2023 · 8 comments

Comments

@ejalaa12
Copy link

The Range message will get an additional field for the variance.
I don't know if this is relevant for you guys, but this issue is simply a notification, feel free to close it if it's not a change that you could benefit from.

You can see details about the PR here

@jlblancoc
Copy link
Member

@ejalaa12 This has been finally addressed here:
67358e9

so MRPT >= v2.11.2 will use the new variance field.

@ejalaa12
Copy link
Author

@jlblancoc awesome! I saw the commit, this a clever way of making sure the member exist.
I guess this makes it retro-compatibke with old version of the Range message as well.

@jlblancoc
Copy link
Member

Exactly 👍

@jlblancoc
Copy link
Member

However, for some reason, the if constexpr trick fails on Humble... hmm....

https://build.ros2.org/job/Hdev__mrpt2__ubuntu_jammy_amd64/349/console

03:46:44 [ 92%] Building CXX object libs/ros2bridge/CMakeFiles/ros2bridge.dir/src/range.cpp.o
03:46:44 /tmp/ws/src/mrpt2/libs/ros2bridge/src/range.cpp: In function ‘bool mrpt::ros2bridge::fromROS(const Range&, mrpt::obs::CObservationRange&)’:
03:46:44 /tmp/ws/src/mrpt2/libs/ros2bridge/src/range.cpp:43:78: error: ‘const Range’ {aka ‘const struct sensor_msgs::msg::Range_<std::allocator<void> >’} has no member named ‘variance’
03:46:44    43 |                 obj.sensedData.at(0).sensorNoiseStdDeviation = std::sqrt(msg.variance);
03:46:44       |                                                                              ^~~~~~~~

I'll investigate it.

@jlblancoc jlblancoc reopened this Oct 24, 2023
@jolting
Copy link
Member

jolting commented Oct 24, 2023

This was added on March 15. It didn't make Humble.
ros2/common_interfaces@05d7e19

@jolting
Copy link
Member

jolting commented Oct 24, 2023

Maybe try it with declval?

template <class T>
struct has_variance<T, std::void_t<decltype(std::declval<T>().variance)>> : std::true_type
{
};

@jlblancoc
Copy link
Member

This was added on March 15. It didn't make Humble. ros2/common_interfaces@05d7e19

Yeap, exactly! :-)

@jlblancoc
Copy link
Member

jlblancoc commented Oct 25, 2023

@jolting It was something else... I just found (the hard way..) that everything inside an if constexpr() is actually parsed by the compiler (even if the condition is false)... except if it's inside a template. Solution -> move that part to a template, and it's now working (ignoring) on humble too! 4b6e108

PS: before that, I also tried the declval trick without luck... :-( Thanks!!

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

3 participants