ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
10.19k stars 16.77k forks source link

Gimbal enhancement list #20985

Open rmackay9 opened 2 years ago

rmackay9 commented 2 years ago

This is a consolidated list of gimbal enhancements:

The corresponding Camera enhancement list is here https://github.com/ArduPilot/ardupilot/issues/23151 The MavlinkV2 gimbal spec is here

Completed items

These ground stations Issues and PRs should also be resolved/merged

olliw42 commented 2 years ago

fantastic list

ground station/MP issues

:)

rmackay9 commented 2 years ago

@olliw42,

Txs very much for the list. By the way, I've created another PR (see link above) which I hope takes us one more step forward. Also I think I need hardware to test all our various drivers so I've raised a proposal including for a SToRM32 gimbal. Any feedback or suggestions are greatly appreciated.

julianoes commented 2 years ago

@rmackay9 good list, and great effort adding support!

If I could add one item to the list, it would be to change the name of the driver to "MAVLink Gimbal v2" rather than Gremsy as the goal would be to have this as a generic protocol rather than a Gremsy specific one. Of course it can still be noted in the description that it works with Gremsy.

If you have questions or gripes with the gimbal v2 docs, ping me, and I'll try to help.

olliw42 commented 2 years ago

@julianoes

If I could add one item to the list, it would be to change the name of the driver to "MAVLink Gimbal v2" rather than Gremsy as the goal would be to have this as a generic protocol rather than a Gremsy specific one

there had been some discussion on this here: https://discuss.ardupilot.org/t/gimbal-hardware-for-randym/87220/5

Let me cite the relevant part from Randy's post: "I certainly like the idea of a single MAVLink gimbal driver but so far I’ve seen 3 different mavlink implementations (STorM32, Gremsy, NextVision) and they’re all different enough that I fear I would be unable to actually make it work. So for now I think I’m going to stick with separate drivers and hopefully the day will come where we can make them all inherit from the same base class."

rmackay9 commented 2 years ago

@julianoes,

Yes, what @olliw42 says is the current state. I'm not opposed to it, I just need at least one more example gimbal that can use the driver as-is. Instead of renaming the current one, I would probably create a new enum entry (maybe called "MAVLink Gimbal v2") that uses the same driver under the cover but let's see what happens...

Txs very much for the offer re the gimbalv2 docs.

We still have a couple more messages to add support for and then I was thinking of removing the WIP tags on at least the messages that we're using in AP.

rmackay9 commented 1 year ago

@julianoes,

I've realised that the new mavlink messages don't have the concept of MAV_MOUNT_MODE. At the moment, we're continuing to support the DO_MOUNT_CONTROL and DO_MOUNT_CONFIGURE commands that allow setting the mode but I wonder how you were thinking we could do without the mode concept and the ability to set it?

In particular I think the pilot (or mission or lua script) needs to be able to specify the gimbal go into special modes like the Retracted position (which I'm interpreting as the gimbal relaxing the motors) or Neutral position (which is normally pointing forward). These two seem to be handled using the the GIMBAL_MANAGER_FLAGS which has neutral and retract bits.

.. but the pilot also wants to be able to specify that they're in control using the RC transmitter which they do by setting the mode to RC_TARGETING. I suspect you will say that we should use MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE but "RC input" is not a mavlink system so it doesn't have a sysid/comp-id.

.. there are other gimbal modes that we support including pointing at home, pointing at a sysid (e.g. point at another vehicle), etc.

julianoes commented 1 year ago

These two seem to be handled using the the GIMBAL_MANAGER_FLAGS which has neutral and retract bits.

Yes, that was the idea there.

but "RC input" is not a mavlink system so it doesn't have a sysid/comp-id.

So to signal that RC is in control, I use the sysid_primary_control and compid_primary_control of the autopilot (for PX4 that's by default 1, 1) which means that itself is in control, and itself has an RC receiver. I understand this is a bit of a kludge...

pointing at home, pointing at a sysid (e.g. point at another vehicle)

For tracking we usually would set some camera with sysid/compid in control which then does the tracking but I can see how that doesn't answer pointing at a sysid and pointing at home.

Should we extend MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW for these use cases or should we add one more message, e.g. MAV_CMD_DO_GIMBAL_MANAGER_TRACK, and then an enum listing the various tracking options.

And that would be different from MAV_CMD_CAMERA_TRACK_POINT which is more for a camera.

olliw42 commented 1 year ago

@julianoes

this isn't meant sarcastic at all, but you may understand that I kind of feel confirmed in what I am saying since ca 2 years and not getting through with it

while your suggestions may somehow may allow to achieve the things, it's obviously of the kind of from-behind-through-the-chest type of workaround. As I always do, I wonder, why not putting it onto solid feet

sorry for being a pain

So to signal that RC is in control, I use the sysid_primary_control and compid_primary_control of the autopilot (for PX4 that's by default 1, 1) which means that itself is in control, and itself has an RC receiver. I understand this is a bit of a kludge...

and there might be other reasons it may be set to itself in control, like missions, .... how then to discriminate what the intention is

For tracking we usually would set some camera with sysid/compid in control which then does the tracking but I can see how that doesn't answer pointing at a sysid and pointing at home.

but most cameras out there can't be set with sysid/compid in control and then do the tracking, so not even this would be an answer in many cases

Should we extend MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW for these use cases or should we add one more message, e.g. MAV_CMD_DO_GIMBAL_MANAGER_TRACK, and then an enum listing the various tracking options.

And that would be different from MAV_CMD_CAMERA_TRACK_POINT which is more for a camera.

so you end up with a message/command for every case even though all it needs is a mount_mode (aka super mode) value

hmhmhm

rmackay9 commented 1 year ago

@julianoes @olliw42,

OK great thanks. I'll go and think about it a bit more but I think we need to retain the concept of gimbal mode rather than trying to squish it into the existing messages or flags. I think we will probably need a set-mode command and also reporting back somehow from the gimbal manager on what the gimbal's mode is.

olliw42 commented 1 year ago

I think we need to retain the concept of gimbal mode rather than trying to squish it into the existing messages or flags. I think we will probably need a set-mode command and also reporting back somehow from the gimbal manager on what the gimbal's mode is.

that's my opinion too, except that I made "gimbal mode" a bit more general, calling it "super mode" (which is admitedly a silly name, pl feel free to invent a better one).

I wonder if you might find it usefull to read the part on "super modes" in here http://www.olliw.eu/2020/mavlink-gimbal-protocol-v2/. Sadly, there is no direct link to the relevant location, so please scroll down to the paragraph which starts with "Remains to clarify what the super modes are." (seraching in the web page for super modes should lead you quickly)

I wonder if this isn't exactly what you actually want.

julianoes commented 1 year ago

Alright, I'm open for suggestions :smile:.

KylePreuss commented 1 year ago

Without the concept of these modes how does a GCS know if the gimbal is supposed to be looking at a lat/lon (i.e. MAV_MOUNT_MODE_GPS_POINT) vs being controlled by angles or slews? It sounds like it could be accomplished thru additional GIMBAL_MANAGER_FLAGs or a mode field. Either way it may be useful.

Along those lines I'm curious how the GCS might request / see the last commanded values for those modes e.g. get the lat/lon from the last MAV_CMD_DO_SET_ROI_LOCATION but that is another issue.

@olliw42 FYI your link on the gimbal protocol has gone down