mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-27 10:13:57 -04:00
AP_Camera: changed update_location() to return true for camera trigger
Makes the main vehicle code responsible for taking a photo so logging can occur
This commit is contained in:
parent
7fa1fe8590
commit
f5154d9e7a
@ -216,24 +216,28 @@ AP_Camera::control_msg(mavlink_message_t* msg)
|
||||
}
|
||||
|
||||
|
||||
// update location, for triggering by GPS distance moved
|
||||
void AP_Camera::update_location(const struct Location &loc)
|
||||
/* update location, for triggering by GPS distance moved
|
||||
This function returns true if a picture should be taken
|
||||
The caller is responsible for taking the picture based on the return value of this function.
|
||||
The caller is also responsible for logging the details about the photo
|
||||
*/
|
||||
bool AP_Camera::update_location(const struct Location &loc)
|
||||
{
|
||||
if (_trigg_dist == 0.0f) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (_last_location.lat == 0 && _last_location.lng == 0) {
|
||||
_last_location = loc;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (_last_location.lat == loc.lat && _last_location.lng == loc.lng) {
|
||||
// we haven't moved - this can happen as update_location() may
|
||||
// be called without a new GPS fix
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (get_distance(&loc, &_last_location) < _trigg_dist) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
_last_location = loc;
|
||||
trigger_pic();
|
||||
return true;
|
||||
}
|
||||
|
@ -54,7 +54,8 @@ public:
|
||||
void configure_msg(mavlink_message_t* msg);
|
||||
void control_msg(mavlink_message_t* msg);
|
||||
|
||||
void update_location(const struct Location &loc);
|
||||
// Update location of vehicle and return true if a picture should be taken
|
||||
bool update_location(const struct Location &loc);
|
||||
|
||||
static const struct AP_Param::GroupInfo var_info[];
|
||||
|
||||
@ -72,7 +73,7 @@ private:
|
||||
void throttle_pic(); // pictures blurry? use this trigger. Turns off the throttle until for # of cycles of medium loop then takes the picture and re-enables the throttle.
|
||||
void distance_pic(); // pictures blurry? use this trigger. Turns off the throttle until closer to waypoint then takes the picture and re-enables the throttle.
|
||||
void transistor_pic(); // hacked the circuit to run a transistor? use this trigger to send output.
|
||||
|
||||
|
||||
AP_Float _trigg_dist; // distance between trigger points (meters)
|
||||
struct Location _last_location;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user