Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 25 additions & 26 deletions tf2/src/buffer_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,14 @@ tf2::TF2Error BufferCore::walkToTopParent(
}
// Erase all duplicate items from frame_chain
if (n > 0u) {
frame_chain->erase(frame_chain->begin() + (n - 1u), frame_chain->end());
frame_chain->erase(frame_chain->begin() + (n + 1u), frame_chain->end());
}

if (m < reverse_frame_chain.size()) {
size_t i = m + 1uL;
while (i > 0u) {
--i;
int i = m + 1;
while (i >= 0) {
frame_chain->push_back(reverse_frame_chain[i]);
--i;
}
}
}
Expand Down Expand Up @@ -1583,25 +1583,24 @@ void BufferCore::_chainAsVector(
}
}

if (source_time != target_time) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Removing this check is clearly wrong. You only traverse the tree a second time if the times are different.

Copy link
Author

Choose a reason for hiding this comment

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

In the Noetic implementation ig this was'nt there as mentioned in the issue which is addressed by this PR

std::vector<CompactFrameID> target_frame_chain;
retval = walkToTopParent(
accum, target_time, target_id, fixed_id, &error_string,
&target_frame_chain);
std::vector<CompactFrameID> target_frame_chain;
retval = walkToTopParent(
accum, target_time, fixed_id, target_id, &error_string,
&target_frame_chain);

if (retval != tf2::TF2Error::TF2_NO_ERROR) {
switch (retval) {
case tf2::TF2Error::TF2_CONNECTIVITY_ERROR:
throw ConnectivityException(error_string);
case tf2::TF2Error::TF2_EXTRAPOLATION_ERROR:
throw ExtrapolationException(error_string);
case tf2::TF2Error::TF2_LOOKUP_ERROR:
throw LookupException(error_string);
default:
CONSOLE_BRIDGE_logError("Unknown error code: %d", retval);
assert(0);
}
if (retval != tf2::TF2Error::TF2_NO_ERROR) {
switch (retval) {
case tf2::TF2Error::TF2_CONNECTIVITY_ERROR:
throw ConnectivityException(error_string);
case tf2::TF2Error::TF2_EXTRAPOLATION_ERROR:
throw ExtrapolationException(error_string);
case tf2::TF2Error::TF2_LOOKUP_ERROR:
throw LookupException(error_string);
default:
CONSOLE_BRIDGE_logError("Unknown error code: %d", retval);
assert(0);
}

size_t m = target_frame_chain.size();
size_t n = source_frame_chain.size();
while (m > 0u && n > 0u) {
Expand All @@ -1613,13 +1612,13 @@ void BufferCore::_chainAsVector(
}
// Erase all duplicate items from frame_chain
if (n > 0u) {
source_frame_chain.erase(source_frame_chain.begin() + (n - 1u), source_frame_chain.end());
source_frame_chain.erase(source_frame_chain.begin() + (n + 1u), source_frame_chain.end());
}

if (m < target_frame_chain.size()) {
for (size_t i = 0u; i <= m; ++i) {
source_frame_chain.push_back(target_frame_chain[i]);
}
int i = m + 1;
while (i >= 0) {
source_frame_chain.push_back(target_frame_chain[i]);
--i;
}
}

Expand Down