Browse Source

AC_Avoidance: add adjust_velocity that accepts Vector3f for convenience

We should actually modify this function to scale back the z axis in order to avoid breaching the vertical fence.  Currently breaching the vertical fence is handled within the position controller which is inconsistent.
master
Randy Mackay 9 years ago
parent
commit
f27cf8d388
  1. 9
      libraries/AC_Avoidance/AC_Avoid.cpp
  2. 2
      libraries/AC_Avoidance/AC_Avoid.h

9
libraries/AC_Avoidance/AC_Avoid.cpp

@ -37,6 +37,15 @@ void AC_Avoid::adjust_velocity(const float kP, const float accel_cmss, Vector2f @@ -37,6 +37,15 @@ void AC_Avoid::adjust_velocity(const float kP, const float accel_cmss, Vector2f
}
}
// convenience function to accept Vector3f. Only x and y are adjusted
void AC_Avoid::adjust_velocity(const float kP, const float accel_cmss, Vector3f &desired_vel)
{
Vector2f des_vel_xy(desired_vel.x, desired_vel.y);
adjust_velocity(kP, accel_cmss, des_vel_xy);
desired_vel.x = des_vel_xy.x;
desired_vel.y = des_vel_xy.y;
}
/*
* Adjusts the desired velocity for the circular fence.
*/

2
libraries/AC_Avoidance/AC_Avoid.h

@ -27,8 +27,10 @@ public: @@ -27,8 +27,10 @@ public:
/*
* Adjusts the desired velocity so that the vehicle can stop
* before the fence/object.
* Note: Vector3f version is for convenience and only adjusts x and y axis
*/
void adjust_velocity(const float kP, const float accel_cmss, Vector2f &desired_vel);
void adjust_velocity(const float kP, const float accel_cmss, Vector3f &desired_vel);
static const struct AP_Param::GroupInfo var_info[];

Loading…
Cancel
Save