-
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_Camera: Add Camera Tracking functionality (WIP) #27773
Open
khanasif786
wants to merge
5
commits into
ArduPilot:master
Choose a base branch
from
khanasif786:mav_cmd_camera_final
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+458
−49
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
766f08a
AP_Camera: Add Camera Tracking functionality
khanasif786 0cee9f7
AP_Camera: add Follow functionality for the tracked object
khanasif786 48b7971
AP_Follow: add Follow functionality for the tracked object
khanasif786 83b995d
GCS_MAVLink: add Follow functionality for the tracked object
khanasif786 d4b3b55
ArduCopter: add Follow functionality for the tracked object
khanasif786 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,14 @@ class AP_Camera_Backend | |
// p1,p2 are in range 0 to 1. 0 is left or top, 1 is right or bottom | ||
bool set_tracking(TrackingType tracking_type, const Vector2f& top_left, const Vector2f& bottom_right); | ||
|
||
// returns true if the objkect to be tracked is visible in the frame | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sp. objkect -> object |
||
bool is_tracking_object_visible() { | ||
if (camera_settings._cam_tracking_status.tracking_status & CAMERA_TRACKING_STATUS_FLAGS::CAMERA_TRACKING_STATUS_FLAGS_ACTIVE) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
#if AP_CAMERA_TRACKING_ENABLED | ||
// default tracking supported by camera | ||
virtual bool set_tracking_internal(TrackingType tracking_type, const Vector2f& top_left, const Vector2f& bottom_right) { return false; } | ||
|
@@ -113,6 +121,9 @@ class AP_Camera_Backend | |
// handle camera information message | ||
void handle_message_camera_information(mavlink_channel_t chan, const mavlink_message_t &msg); | ||
|
||
// handle image tracking status messages | ||
void handle_message_camera_tracking_image_status(mavlink_channel_t chan, const mavlink_message_t &msg); | ||
|
||
// configure camera | ||
virtual void configure(float shooting_mode, float shutter_speed, float aperture, float ISO, int32_t exposure_type, int32_t cmd_id, float engine_cutoff_time) {} | ||
|
||
|
@@ -139,6 +150,9 @@ class AP_Camera_Backend | |
// send camera capture status message to GCS | ||
virtual void send_camera_capture_status(mavlink_channel_t chan) const; | ||
|
||
// send camera tracking image status message to GCS | ||
void send_camera_tracking_image_status(mavlink_channel_t chan) const; | ||
|
||
#if AP_CAMERA_SCRIPTING_ENABLED | ||
// accessor to allow scripting backend to retrieve state | ||
// returns true on success and cam_state is filled in | ||
|
@@ -207,9 +221,16 @@ class AP_Camera_Backend | |
struct { | ||
bool _got_camera_info; // true once camera has provided CAMERA_INFORMATION | ||
mavlink_camera_information_t _cam_info {}; // latest camera information received from camera | ||
mavlink_camera_tracking_image_status_t _cam_tracking_status {}; | ||
uint8_t _sysid_camera; // sysid of camera | ||
uint8_t _compid_camera; // component id of gimbal | ||
} camera_settings; | ||
|
||
enum CAMERA_TRACKING_STATUS_FLAGS : uint8_t { | ||
CAMERA_TRACKING_STATUS_FLAGS_IDLE, | ||
CAMERA_TRACKING_STATUS_FLAGS_ACTIVE, | ||
CAMERA_TRACKING_STATUS_FLAGS_ERROR | ||
}; | ||
Comment on lines
+229
to
+233
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shadows #define HAVE_ENUM_CAMERA_TRACKING_STATUS_FLAGS
typedef enum CAMERA_TRACKING_STATUS_FLAGS
{
CAMERA_TRACKING_STATUS_FLAGS_IDLE=0, /* Camera is not tracking | */
CAMERA_TRACKING_STATUS_FLAGS_ACTIVE=1, /* Camera is tracking | */
CAMERA_TRACKING_STATUS_FLAGS_ERROR=2, /* Camera tracking in error state | */
CAMERA_TRACKING_STATUS_FLAGS_ENUM_END=3, /* | */
} CAMERA_TRACKING_STATUS_FLAGS;
#endif in |
||
}; | ||
|
||
#endif // AP_CAMERA_ENABLED |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Missing
break
. Compilation withclang
fails.