Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_Camera/AP_Camera_Scripting.cpp
Views: 1798
#include "AP_Camera_Scripting.h"12#if AP_CAMERA_SCRIPTING_ENABLED34extern const AP_HAL::HAL& hal;56// entry point to actually take a picture7bool AP_Camera_Scripting::trigger_pic()8{9// increment counter to allow backend to notice request10_cam_state.take_pic_incr++;11return true;12}1314// start or stop video recording. returns true on success15// set start_recording = true to start record, false to stop recording16bool AP_Camera_Scripting::record_video(bool start_recording)17{18_cam_state.recording_video = start_recording;19return true;20}2122// set zoom specified as a rate or percentage23bool AP_Camera_Scripting::set_zoom(ZoomType zoom_type, float zoom_value)24{25_cam_state.zoom_type = (uint8_t)zoom_type;26_cam_state.zoom_value = zoom_value;27return true;28}2930// set focus specified as rate, percentage or auto31// focus in = -1, focus hold = 0, focus out = 132SetFocusResult AP_Camera_Scripting::set_focus(FocusType focus_type, float focus_value)33{34_cam_state.focus_type = (uint8_t)focus_type;35_cam_state.focus_value = focus_value;36return SetFocusResult::ACCEPTED;37}3839// set tracking to none, point or rectangle (see TrackingType enum)40// if POINT only p1 is used, if RECTANGLE then p1 is top-left, p2 is bottom-right41// p1,p2 are in range 0 to 1. 0 is left or top, 1 is right or bottom42bool AP_Camera_Scripting::set_tracking(TrackingType tracking_type, const Vector2f& p1, const Vector2f& p2)43{44_cam_state.tracking_type = (uint8_t)tracking_type;45_cam_state.tracking_p1 = p1;46_cam_state.tracking_p2 = p2;47return true;48}4950// access for scripting backend to retrieve state51// returns true on success and cam_state is filled in52bool AP_Camera_Scripting::get_state(AP_Camera::camera_state_t& cam_state)53{54cam_state = _cam_state;55return true;56}5758#endif // AP_CAMERA_SCRIPTING_ENABLED596061