Ardupilot avoid control code logic whether a small problem

void AC_Avoid::adjust_velocity_polygon(float kP, float accel_cmss, Vector2f &desired_vel_cms,
const Vector2f* boundary, uint16_t num_points, bool earth_frame, float margin, float dt, bool stay_inside)
{

for (uint16_t i=0; i<num_points; i++)
{
uint16_t j = i+1;
if (j >= num_points)
{
j = 0;
}
//end points of current edge
Vector2f start = boundary[j];
Vector2f end = boundary[i];
if ((AC_Avoid::BehaviourType)_behavior.get() == BEHAVIOR_SLIDE)
{

}
the code :Vector2f start = boundary[i]; Vector2f end = boundary[j]; //结束

Please describe the problem you are seeing in detail.

I think the code should be modified:Vector2f start = boundary[i]; Vector2f end = boundary[j];

Please submit a direct pull request to the code:

https://ardupilot.org/dev/docs/submitting-patches-back-to-master.html

1 Like