AP_Camera: support image tracking

This commit is contained in:
Randy Mackay
2023-05-08 21:26:35 +10:00
parent 858a1e8b40
commit a6cc9f042a
6 changed files with 86 additions and 0 deletions
@@ -37,6 +37,19 @@ bool AP_Camera_Scripting::set_focus(FocusType focus_type, float focus_value)
return true;
}
// set tracking to none, point or rectangle (see TrackingType enum)
// if POINT only p1 is used, if RECTANGLE then p1 is top-left, p2 is bottom-right
// p1,p2 are in range 0 to 1. 0 is left or top, 1 is right or bottom
bool AP_Camera_Scripting::set_tracking(TrackingType tracking_type, const Vector2f& p1, const Vector2f& p2)
{
_cam_state.tracking_type = (uint8_t)tracking_type;
_cam_state.tracking_p1x = p1.x;
_cam_state.tracking_p1y = p1.y;
_cam_state.tracking_p2x = p2.x;
_cam_state.tracking_p2y = p2.y;
return true;
}
// access for scripting backend to retrieve state
// returns true on success and cam_state is filled in
bool AP_Camera_Scripting::get_state(AP_Camera::camera_state_t& cam_state)