About cruise_speed and cruise_throttle

Dear all,

After the topic for John Easton’s wobbly navigation (John Easton's boat navigation) which was initially raised on facebook, I try to set the cruise_speed and cruise_throttle as negative value. I discover severe oscillation on the rover or even can not move after armed.

Here is the figure I plot in meters:

This is the lattitude measurement.

This is the longtitude measurement.

I think the cruise_speed and cruise_throttle should not be set as negative and there is some rational range.

Am I right?

Thank you very much.

Zhijian,
Negative is not a good choice for these parameters! :-). We can add a checks to stop users from adding negative value but it’s already in the parameter description info which should be visible in the ground stations.


Thank you very much, rmackay.

But I double the source code somehow may exist the problem about cruise_speed and cruise_throttle. Let us look at the code below:

APMrover2/mode.cpp:

// estimate maximum vehicle speed (in m/s)
// cruise_speed is in m/s, cruise_throttle should be in the range -1 to +1
float Mode::calc_speed_max(float cruise_speed, float cruise_throttle) const
{
float speed_max;

// sanity checks
if (cruise_throttle > 1.0f || cruise_throttle < 0.05f) {
speed_max = cruise_speed;
} else {
// project vehicle’s maximum speed
speed_max = (1.0f / cruise_throttle) * cruise_speed;
}

// constrain to 30m/s (108km/h) and return
return constrain_float(speed_max, 0.0f, 30.0f);
}

I draw this code in figure:

If the cruise_speed is near the value 0.05 (for example 0.51), the speed_max may be 20 times of the cruise_speed. I think this is not rational, right?

And the negative value is not contraint here, which may also lead to abnormal behavior.

Am I right?

Thanks.

Sorry, type error. I doubt the source code somehow may exist the problem

Sounds like you worked it out but in any case, I think if the cruise-throttle were way down at 0.051 (i.e. 5.1%) then it’s reasonable that the vehicle’s top speed could be 20x the cruise-speed. That would generally be a poor choice of cruise-throttle and cruise-speed by the user but it’s a reasonable result still.

Thanks for investigating