-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mbf publishes zero cmd_vel if computeVelocityCmd returns False #195
Comments
Is |
I suggest let sampling time(dt) be a computeVelocityCmd() function argument. Because local planner role is like mobile robot motion controller also call rough velocity command interpolater, so I think sampling time is important. But in my experience, if sampling time is not the same will face strange behavior. In addtion, I notice AbstractControllerExecution's calling_duration_ is not the DEFAULT_CONTROLLER_FREQUENCY. when I running on my design local planner, it show the moving freqency is 0.05 but I didn't change DEFAULT_CONTROLLER_FREQUENCY. As shown below fiugre link. |
@Rayman I don't think we have access to the @q576333 I disagree that If we go full-on we can do it like the ROS timers: pass the expected and real value. |
The DWA planner does the following in dwa_planner.cpp. It might be useful: //Assuming this planner is being run within the navigation stack, we can
//just do an upward search for the frequency at which its being run. This
//also allows the frequency to be overwritten locally.
std::string controller_frequency_param_name;
if(!private_nh.searchParam("controller_frequency", controller_frequency_param_name)) {
sim_period_ = 0.05;
} else {
double controller_frequency = 0;
private_nh.param(controller_frequency_param_name, controller_frequency, 20.0);
if(controller_frequency > 0) {
sim_period_ = 1.0 / controller_frequency;
} else {
ROS_WARN("A controller_frequency less than 0 has been set. Ignoring the parameter, assuming a rate of 20Hz");
sim_period_ = 0.05;
}
} |
Thanks! But trying to do our own parameter search seems hacky. And this which will break here I guess? |
Ah, good point. It seems that in the original navigation stack |
I think cached parameters do the trick for you:
But I never tried them myself; and I'm not 100% they work with dynamically reconfigured parameters. Please report here if you try; I'm curious |
Even if it works, I still find it hacky to perform a search for a parameter name that might exist and then subscribe to the roscore to get updates from said parameter. |
Well, you know current frequency, but as u said, is a dynamic param, so much better (and more precise) to get notified when it changes that continuously monitor the frequency by measuring the lag between calls. |
@Timple Please open a PR and add an if-statement around https://github.com/magazino/move_base_flex/blob/9f9fd9c1b14ce56822118c820740ed22184b594a/mbf_abstract_nav/src/abstract_controller_execution.cpp#L399 |
For @Timple's particular usecase I still find nicer to use cached parameters, but I'm ok with the param solution; we already have |
@corot Room for thought, I like the actual Nevertheless I'll implement the |
We could also extend the plugin interface and provide the time delta. |
I guess that would break backwards compatibility with all mbf local planner plugins? |
For our local planner we need
dt
. So on the first call tocomputeVelocityCmd
we return false and save the timestamp. So every next loop can calculatedt
.But this causes a zero cmd_vel to be published. However often we are not standing still. So the zero cmd_vel is undesired.
Of course internally we can remember the last timestamp, but there is also no guarantee that this is not from a while back (sometimes we do stand still and do nothing).
Is there a proper way to handle this scenario?
if dt > 0.1: we probably stood still inbetween
dt
as argument tocomputeVelocityCmd
The text was updated successfully, but these errors were encountered: