mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-11 18:01:35 +08:00
add camera trigger feedback (input capture when camera actually takes the photo)
This commit is contained in:
committed by
Daniel Agar
parent
5229882470
commit
42afc88285
@@ -53,6 +53,7 @@ CameraCapture::CameraCapture() :
|
||||
_trigger_pub(nullptr),
|
||||
_command_ack_pub(nullptr),
|
||||
_command_sub(-1),
|
||||
_hotshoe_trigger_feedback(false),
|
||||
_capture_seq(0),
|
||||
_last_fall_time(0),
|
||||
_last_exposure_time(0),
|
||||
@@ -65,8 +66,13 @@ CameraCapture::CameraCapture() :
|
||||
_p_strobe_delay = param_find("CAM_CAP_DELAY");
|
||||
param_get(_p_strobe_delay, &_strobe_delay);
|
||||
|
||||
struct camera_trigger_s trigger = {};
|
||||
_trigger_pub = orb_advertise(ORB_ID(camera_trigger), &trigger);
|
||||
_p_hotshoe_trigger_feedback = param_find("CAM_HSHOE_FBACK");
|
||||
param_get(_p_hotshoe_trigger_feedback, &_hotshoe_trigger_feedback);
|
||||
|
||||
if (_hotshoe_trigger_feedback != 0) {
|
||||
struct camera_trigger_s trigger = {};
|
||||
_trigger_pub = orb_advertise(ORB_ID(camera_trigger), &trigger);
|
||||
}
|
||||
}
|
||||
|
||||
CameraCapture::~CameraCapture()
|
||||
@@ -85,7 +91,9 @@ CameraCapture::capture_callback(uint32_t chan_index,
|
||||
trigger.timestamp = edge_time - ((edge_time - _last_fall_time) / 2); // Get timestamp of mid-exposure
|
||||
trigger.seq = _capture_seq++;
|
||||
|
||||
orb_publish(ORB_ID(camera_trigger), _trigger_pub, &trigger);
|
||||
if (_hotshoe_trigger_feedback != 0) {
|
||||
orb_publish(ORB_ID(camera_trigger), _trigger_pub, &trigger);
|
||||
}
|
||||
|
||||
_last_exposure_time = edge_time - _last_fall_time;
|
||||
}
|
||||
@@ -201,7 +209,8 @@ void
|
||||
CameraCapture::start()
|
||||
{
|
||||
// start to monitor at low rates for capture control commands
|
||||
work_queue(LPWORK, &_work, (worker_t)&CameraCapture::cycle_trampoline, this, USEC2TICK(1)); // TODO : is this low rate??!
|
||||
work_queue(LPWORK, &_work, (worker_t)&CameraCapture::cycle_trampoline, this,
|
||||
USEC2TICK(1)); // TODO : is this low rate??!
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user