-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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_Mount: add CADDX gimbal support #28942
Conversation
df038ba
to
358d493
Compare
why drop the lock types and control? |
Hi @Hwurzburg, I dropped the lock types and control because I couldn't get them to work and also they are really an enhancement so they naturally fall into a follow-up PR that could potentially affect other gimbals as well. The Siyi gimbal for example also supports FPV mode and users have been asking for that for a long time so we could do the two together |
Hi please add support for this board Don't forget to add Bmp 280 baro because new versions come with bmp280. |
Hi @Lalbabu2001, I've created an issue here to capture this enhancement request #28945. No promises on when/if it will be done though. I'm not personally very experienced porting AP to new boards. |
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.
partial on-call review only :-)
PeterB's requests addressed, thanks!
358d493
to
317c8b3
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.
Looks pretty good.
libraries/AP_Mount/AP_Mount_CADDX.h
Outdated
|
||
#include "AP_Mount_Backend_Serial.h" | ||
#include <AP_HAL/AP_HAL.h> | ||
#include <AP_Math/AP_Math.h> |
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.
#include <AP_Math/AP_Math.h> |
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.
removed include, thanks
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.
Actually I've put this back because AP_Math.h is where "quaternion" is included
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.
diff --git a/libraries/AP_Mount/AP_Mount_CADDX.h b/libraries/AP_Mount/AP_Mount_CADDX.h
index fe423f55459..3d831209bf7 100644
--- a/libraries/AP_Mount/AP_Mount_CADDX.h
+++ b/libraries/AP_Mount/AP_Mount_CADDX.h
@@ -8,8 +8,7 @@
#if HAL_MOUNT_CADDX_ENABLED
#include "AP_Mount_Backend_Serial.h"
-#include <AP_Math/AP_Math.h>
-#include <AP_Common/AP_Common.h>
+#include <AP_Math/quaternion.h>
class AP_Mount_CADDX : public AP_Mount_Backend_Serial
{
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.
ok thanks. Updated to remove AP_Common.h and change to <AP_Math/quaternion.h>. I'm surprised we don't need AP_Common.h in there. We include that in every other AP_Mount backend so I guess we could remove it from many places
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.
ok thanks. Updated to remove AP_Common.h and change to <AP_Math/quaternion.h>. I'm surprised we don't need AP_Common.h in there. We include that in every other AP_Mount backend so I guess we could remove it from many places
Probably, yes - and that will save compile time, which everybody likes.
We're getting away with some shenanigans by having those all around the place - things like the stdint.h include come to mind :-)
protected: | ||
|
||
// get attitude as a quaternion. returns true on success | ||
bool get_attitude_quaternion(Quaternion& att_quat) override; |
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.
bool get_attitude_quaternion(Quaternion& att_quat) override; | |
bool get_attitude_quaternion(class Quaternion& att_quat) override; |
Not actually including the right header to get this - just getting it transitively somehow
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'm going to skip this change I think because it leads to a compile failure and would make it inconsistent with the virtual method that it is overriding and also all other drivers. Apologies, I'm probably misunderstanding something
libraries/AP_Mount/AP_Mount_CADDX.h
Outdated
|
||
// lock mode enum | ||
enum class LockMode { | ||
FOLLOW = 0, |
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.
This doesn't make a lot of sense!
FOLLOW = 0, |
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.
Hi @peterbarker, thanks for the review. I've removed this line because we don't use it but I can imagine that we could use it as a default value so not sure why it doesn't makes sense?
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.
Generally we don't use the same enumeration which is giving names to bit-offsets for combinations of those bits (AKA a "mask").
It would be nice to have some type-safety around this sort of thing, but I've never managed to propose a PR to add that....
317c8b3
to
190f25e
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.
LGTM
libraries/AP_Mount/AP_Mount_CADDX.h
Outdated
|
||
#include "AP_Mount_Backend_Serial.h" | ||
#include <AP_HAL/AP_HAL.h> | ||
#include <AP_Math/AP_Math.h> |
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.
diff --git a/libraries/AP_Mount/AP_Mount_CADDX.h b/libraries/AP_Mount/AP_Mount_CADDX.h
index fe423f55459..3d831209bf7 100644
--- a/libraries/AP_Mount/AP_Mount_CADDX.h
+++ b/libraries/AP_Mount/AP_Mount_CADDX.h
@@ -8,8 +8,7 @@
#if HAL_MOUNT_CADDX_ENABLED
#include "AP_Mount_Backend_Serial.h"
-#include <AP_Math/AP_Math.h>
-#include <AP_Common/AP_Common.h>
+#include <AP_Math/quaternion.h>
class AP_Mount_CADDX : public AP_Mount_Backend_Serial
{
190f25e
to
950b0f2
Compare
Co-authored-by: Randy Mackay <rmackay9@yahoo.com>
950b0f2
to
b943f94
Compare
I've updated with @peterbarker's requests and marked as "MergeOnCIPass" |
Merged it! |
This is a simplified version of @Hwurzburg's previous PR #28373 to add support for the CADDX GM3 gimbal
This simply adds support for the gimbal without trying to support the extra lock types that the gimbal provides. These extra lock types add the ability to control each axis (roll, pitch and yaw) in earth or body frame independently. For example roll control could be in body frame while pitch is in earth frame. This new ability is not supported in this PR.
This has been tested on real hardware and seems OK.
The corresponding wiki PR is here ArduPilot/ardupilot_wiki#6441