[ros-users] extending trajectory_planner by inheriting from other classes

David Feil-Seifer david.feilseifer at gmail.com
Sat Oct 23 08:37:43 UTC 2010

I have found the trajectory_planner and trajectory_planner_ros classes
from the base_local_planner package rather useful. However, I am
trying to extend those classes to make trajectory planner aware of
more than just goal, obstacles, and global path.

Rather than just copy the classes outright, I am trying to make a
class people_planner and people_planner_ros that inherits from
trajectory_planner and trajectory_planner_ros, respectively. I then
re-implement the generate_trajectory function from trajectory_planner
(along with other smaller changes, but that is the main one) to fit my
needs. However, this is impossible with the current version of
trajectory_planner, since functions are not virtual, and data are
declared private instead of protected.

Currently, I am able to just copy the headers to my local package, and
make the changes that I want and include those rather than the headers
from base_local_planner. Then I simply include the base_local_planner
library, and the header changes and variable protection is as I want
it, but that seems less than optimal. Is there a design decision
behind not having data declared protected and functions being virtual?

Thanks in advance,

More information about the ros-users mailing list