-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AP_Mission/AP_Camera: add mavlink STOP_CAPTURE/START_CAPTURE command support and fixes to existing implementation #24772
AP_Mission/AP_Camera: add mavlink STOP_CAPTURE/START_CAPTURE command support and fixes to existing implementation #24772
Conversation
b72dc9b
to
147f44c
Compare
I see Mission doesn't support IMAGE START capture with multiple images. I will create a seperate PR for that if its okay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. This has been tested of course?
d2a8025
to
cf94210
Compare
Tested with single camera in Mission and also with simple mavlink command. Could you please review. |
cf94210
to
8d01a48
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @magicrub. I Have done suggested changes in the new patch
8d01a48
to
dbb2e88
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done changes suggested by @rmackay9
dbb2e88
to
4d9aa36
Compare
4d9aa36
to
21a8fb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rmackay9 Thanks. i have done changes
@@ -269,6 +269,7 @@ class AP_Mission | |||
|
|||
// MAV_CMD_IMAGE_START_CAPTURE support | |||
struct PACKED image_start_capture_Command { | |||
uint8_t instance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this will lead to corruption of the image-start-capture mission command for users that already have the command in a mission on a vehicle. I think this is OK though because Mission Planner at least never had the columns displayed to users so most users were probably leaving all columns blank (see MP PR here ArduPilot/MissionPlanner#3175)
@peterbarker what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any way we can add support without leading corruption ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think if the instance was placed at the end of the structure instead of the beginning.
21a8fb0
to
616fb60
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rmackay9 Addressed your comments. have a look
@@ -269,6 +269,7 @@ class AP_Mission | |||
|
|||
// MAV_CMD_IMAGE_START_CAPTURE support | |||
struct PACKED image_start_capture_Command { | |||
uint8_t instance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any way we can add support without leading corruption ?
if (backend == nullptr) { | ||
return false; | ||
} | ||
backend->take_picture(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should return the result from backend->take_picture() instead of just returning true.
Getting close now. Can you also rebase this on master? |
|
||
// take multiple pictures, time_interval between two consecutive pictures is in miliseconds | ||
// total_num is number of pictures to be taken, -1 means capture forever | ||
void take_multiple_pictures(uint32_t time_interval_ms, int16_t total_num); | ||
bool take_multiple_pictures(uint8_t instance, uint32_t time_interval_ms, int16_t total_num); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should make these take-multiple-pictures methods fail if the total_num is non-zero (e.g. forever or some specified number) and the time_interval_ms is zero. I know you had this originally in the command parser and I asked you to remove it but after testing I see we really do need the check of a non-zero interval... it is better to have it down here in this method anyway though.
We could do this as a follow-up PR though (even I could do it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay upto you then.
if (cmd.content.image_start_capture.total_num_images == 1) { | ||
if (cmd.content.image_start_capture.instance == 0) { | ||
// take pictures for every backend | ||
camera->take_picture(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally I think this take_picture() should also return a boolean which is true if any backend succeeded in taking a picture. I'm happy to do this as a follow-up PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay upto you now.
Co-authored-by: Zachary Zalass <[email protected]>
Co-authored-by: Zachary Zalass <[email protected]>
Co-authored-by: Zachary Zalass <[email protected]>
616fb60
to
841d0cc
Compare
@rmackay9 . I have rebased it. Could you add the functionalities you told in another PR, Thus the code will also get re-tested on different setup. |
issues addressed or will be handled in a follow-up PR
This adds support for MAV_CMD_IMAGE_STOP_CAPTURE. This is from the camera enhancements list #23151
Thanks to @trolledbypro for initial work on this
This has been tested latest in Mission and with simple mavlink command. (Single camera is used) Multiple should work.