robowflex icon indicating copy to clipboard operation
robowflex copied to clipboard

[BUG] Context is reused despite distinct requests, md5 hash is identical

Open werner291 opened this issue 3 years ago • 3 comments

Hello,

unfortunately, the MD5 checksum of a ROS message is of the message definition itself, not of the message contents. It's meant to be used for comparing the version of a message.

Hence, the OMPL planner will re-use a context even with distinct requests, and re-plan between the same (now wrong) start/end states. ~~There does not appear to be any built-in way to compare ROS messages, supposedly because comparing floats is not well-defined.~~

Correction: operator== is implemented for ROS messages. That does require us to hold on to the whole message though. Maybe we could use a shared_ptr to avoid duplication between user code and planner code?

werner291 avatar Sep 02 '21 09:09 werner291

As far as I can tell, this affects benchmarking as well, since it calls the same method: https://github.com/KavrakiLab/robowflex/blob/master/robowflex_library/src/benchmarking.cpp#L216

werner291 avatar Sep 02 '21 11:09 werner291

As a quick-fix from user code, you can forcefully refresh the context before planning:

simple_planner->refreshContext(scene, request, true);
auto response = simple_planner->plan(scene, request);

werner291 avatar Sep 02 '21 11:09 werner291

For benchmarking this is not an issue since preRun calls a force refresh, so context will not be reused. I'll take a look into comparing the entire ROS message - this has been a thorn for a while.

zkingston avatar Oct 28 '21 16:10 zkingston