How can I programmatically set the rosconsole verbosity of an object?
I have a local planner plugin that instantiates a base_local_planner::TrajectoryPlannerROS
object and then calls checkTrajectory
on it. Specifically, this is the function that gets called eventually: TrajectoryPlanner::checkTrajectory
(link to source code)
During execution of my local planner, that function is called a lot in order to evaluate velocity command candidates. As a result, it spams this warning:
ROS_WARN("Invalid Trajectory %f, %f, %f, cost: %f", vx_samp, vy_samp, vtheta_samp, cost);
I know that, from the command line, I can call the set_loggers
service of the corresponding node in order to set the logger level to ERROR
and thus prevent the spamming.
Is there a way to set the logger level when I instantiate the TrajectoryPlannerROS
object in my local planner?
I would like to avoid:
- making a service call (whether programmatic or via the command line)
- forking
base_local_planner
and changing theROS_WARN
toROS_DEBUG
The rosconsole
wiki page has some relevant info, but it seems overkill for what I want to achieve. (Although I've never used anything but the ROS_*
macros, so it may just be lack of familiarity.)
References: