Skip to content

Commit

Permalink
Small improvement in remapping (#393) (#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Aug 1, 2023
1 parent 4f0b6c0 commit e5b99ab
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1312,8 +1312,12 @@ void JointTrajectoryController::sort_to_local_joint_order(
get_node()->get_logger(), "Invalid input size (%zu) for sorting", to_remap.size());
return to_remap;
}
std::vector<double> output;
output.resize(mapping.size(), 0.0);
static std::vector<double> output(dof_, 0.0);
// Only resize if necessary since it's an expensive operation
if (output.size() != mapping.size())
{
output.resize(mapping.size(), 0.0);
}
for (size_t index = 0; index < mapping.size(); ++index)
{
auto map_index = mapping[index];
Expand Down

0 comments on commit e5b99ab

Please sign in to comment.