Skip to content

Commit

Permalink
Small improvement in remapping (#393)
Browse files Browse the repository at this point in the history
Co-authored-by: Bence Magyar <bence.magyar.robotics@gmail.com>
  • Loading branch information
AndyZe and bmagyar authored Jul 31, 2023
1 parent fa72170 commit cc4c221
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1223,8 +1223,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 cc4c221

Please sign in to comment.