ros-controls / ros-controls/ros2_controllers

Dynamic memory allocation in the joint trajectory controller

Open
#392 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug good second issue persistent stale
Dominant language
C++
Stars
834
Forks
530
Avg merge
18h 3m
Merged PRs (30d)
19

Description

Here are some spots of dynamic memory allocation in the realtime update method of the JTC we should try to get rid of:

In fill_partial_goal():
https://github.com/ros-controls/ros2_controllers/blob/d8d661607f770e704b774249a31534fa0eb0d46b/joint_trajectory_controller/src/joint_trajectory_controller.cpp#L1084

And several other places.

In sort_to_local_joint_order():

output.resize(mapping.size(), 0.0);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in joint_trajectory_controller/src/joint_trajectory_controller.cpp at fill_partial_goal() and sort_to_local_joint_order(), then inspect the other allocation sites in the realtime update method. The work is complete when dynamic allocations in that path, including output.resize(mapping.size(), 0.0), are removed without changing controller behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance, robotics
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.