APMrover2: Added precise camera trigger logging

included update_trigger function
added camera trigger precise time mark
detect camera feedback pin status
added support for TRIGGER MSG
corrected according to defines.h
This commit is contained in:
Dario Lindo Andres 2015-06-07 19:22:06 +02:00 committed by Andrew Tridgell
parent 90bf13279b
commit f731a0dc53
6 changed files with 38 additions and 11 deletions

View File

@ -68,6 +68,7 @@ const AP_Scheduler::Task Rover::scheduler_tasks[] = {
SCHED_TASK(update_events, 50, 1000),
SCHED_TASK(check_usb_mux, 3, 1000),
SCHED_TASK(mount_update, 50, 600),
SCHED_TASK(update_trigger, 1, 600),
SCHED_TASK(gcs_failsafe_check, 10, 600),
SCHED_TASK(compass_accumulate, 50, 900),
SCHED_TASK(update_notify, 50, 300),
@ -178,8 +179,22 @@ void Rover::mount_update(void)
#if MOUNT == ENABLED
camera_mount.update();
#endif
}
/*
update camera trigger - 50Hz
*/
void Rover::update_trigger(void)
{
#if CAMERA == ENABLED
camera.trigger_pic_cleanup();
if(camera._camera_triggered == 0 && camera._feedback_pin != -1 && check_digital_pin(camera._feedback_pin) == 0){
gcs_send_message(MSG_CAMERA_FEEDBACK);
if (should_log(MASK_LOG_CAMERA)) {
DataFlash.Log_Write_Camera(ahrs, gps, current_loc);
}
camera._camera_triggered = 1;
}
#endif
}
@ -507,5 +522,5 @@ void Rover::update_navigation()
break;
}
}
AP_HAL_MAIN_CALLBACKS(&rover);
AP_HAL_MAIN_CALLBACKS(&rover);

View File

@ -48,6 +48,7 @@ bool Rover::print_log_menu(void)
PLOG(COMPASS);
PLOG(CAMERA);
PLOG(STEERING);
PLOG(TRIGGER);
#undef PLOG
}
@ -127,6 +128,7 @@ int8_t Rover::select_logs(uint8_t argc, const Menu::arg *argv)
TARG(COMPASS);
TARG(CAMERA);
TARG(STEERING);
TARG(TRIGGER);
#undef TARG
}
@ -475,5 +477,4 @@ void Rover::Log_Write_Attitude() {}
void Rover::start_logging() {}
void Rover::Log_Write_RC(void) {}
#endif // LOGGING_ENABLED
#endif // LOGGING_ENABLED

View File

@ -380,6 +380,7 @@ private:
// private member functions
void ahrs_update();
void mount_update(void);
void update_trigger(void);
void update_alt();
void gcs_failsafe_check(void);
void compass_accumulate(void);
@ -565,4 +566,4 @@ extern Rover rover;
using AP_HAL::millis;
using AP_HAL::micros;
#endif // _ROVER_H_
#endif // _ROVER_H_

View File

@ -370,8 +370,16 @@ void Rover::do_take_picture()
// log_picture - log picture taken and send feedback to GCS
void Rover::log_picture()
{
gcs_send_message(MSG_CAMERA_FEEDBACK);
if (should_log(MASK_LOG_CAMERA)) {
DataFlash.Log_Write_Camera(ahrs, gps, current_loc);
if (camera._feedback_pin == -1 ){
gcs_send_message(MSG_CAMERA_FEEDBACK);
if (should_log(MASK_LOG_CAMERA)) {
DataFlash.Log_Write_Camera(ahrs, gps, current_loc);
}
}
}
else {
camera._camera_triggered = 0;
if (should_log(MASK_LOG_TRIGGER)) {
DataFlash.Log_Write_Trigger(ahrs, gps, current_loc);
}
}
}

View File

@ -311,4 +311,4 @@
#define FIRMWARE_STRING THISFIRMWARE
#else
#define FIRMWARE_STRING THISFIRMWARE " (" GIT_VERSION ")"
#endif
#endif

View File

@ -92,6 +92,8 @@ enum mode {
#define MASK_LOG_ARM_DISARM (1<<15)
#define MASK_LOG_WHEN_DISARMED (1UL<<16)
#define MASK_LOG_IMU_RAW (1UL<<19)
#define MASK_LOG_TRIGGER (1UL<<20)
// Waypoint Modes
// ----------------
@ -126,4 +128,4 @@ enum mode {
// convert a boolean (0 or 1) to a sign for multiplying (0 maps to 1, 1 maps to -1)
#define BOOL_TO_SIGN(bvalue) ((bvalue)?-1:1)
#endif // _DEFINES_H
#endif // _DEFINES_H