mavlink / qgroundcontrol

Cross-platform ground control station for drones (Android, iOS, Mac OS, Linux, Windows)
http://qgroundcontrol.io
3.29k stars 3.62k forks source link

Support of ArduPilot Copter/Rover Follow mode #7811

Closed rmackay9 closed 1 month ago

rmackay9 commented 5 years ago

ArduPilot Copter and Rover have a Follow flight mode which is implemented on the flight controller. There are pros and cons of implementing the logic in the vehicles vs the ground station but in any case, this enhancement request is to make use of the flight controller based Follow mode for regular "FollowMe" where the vehicle follows the person holding the ground station computer.

To make this work, the ground station must publish it's position at 1hz (or faster if possible) to the vehicle using the GLOBAL_POSITION_INT message. Beyond this it's possible that the GCS user could modify the position of the vehicle etc with one of the existing mavlink parameters but I haven't looked into this much.

FYI we have a somewhat related issue on the AP side here to support QGC's GCS based follow-mode (i.e. the logic is done on the ground station computer) but I think we should support both methods.

Some videos of the mode in action:

DonLakeFlyer commented 4 years ago

I suspect that QGC will need to ignore the compass and instead heavily filter and "gate" the GPS heading. So for example, maintain a separate heading that is only updated if the GPS ground speed is over some lower limit (like 1m/s). Some extra heuristics or filtering might also be required to ensure that it doesn't flip back and forth too much.

Yup. That is one of the things I"m going to try. These other is to get the heading from a device compass. Hopefully it won't be too large of a change and I can get it into a point release soon.

So it would just try to move to the edge of a circle surrounding the position provided by the GCS.

I"m going to go out and test a Phantom today to see what it does. I think this may be how it works.

DonLakeFlyer commented 4 years ago

@rmackay9 Ok, so I did so more digging into this including looking at how other firmwares implement. The simple answer is that the firmware should not depend on the gcs for a heading. It should generate it's own heading in whatever way is appropriate so it understands the quality of the value. This is why the mavlink FOLLOW_TARGET message does not include heading. I am so many hours into trying to support this it's just ridiculous. Especially given the fact that QGC already supports FOLLOW_TARGET! So my current point of view is that ArduPilot should support FOLLOW_TARGET which is part of the mavlink spec. I just can't spend more time fighting with another way to do follow. Since you already have follow vehicle you should be inches away on the firmware side from being able to do this.

Hwurzburg commented 4 years ago

sounds like the way to do it to me.....we would only have to add the capability of broadcasting a FOLLOW_TARGET message from the vehicle to allow vehicle to vehicle following like now...or use QGC as the "vehicle" to follow...

the follower would pick a SYS_ID to follow, an offset(alt,distance.angle{NED}) which could be the current offset to target, and follow the broadcaster, correct? like it was moving guided waypoint(but offset to it)

QGC sends this message with its position and the gcs startup home altitude(or no altitude? or current GCS GPS altitude?), not that it absolutely needed, could be fixed above home in the offset setup...

DonLakeFlyer commented 4 years ago

Not sure there is a need to change the vehicle to vehicle follow code since that is all working fine. Only reason would be to support following some other firmware vehicle which has supported FOLLOW_TARGET. But nothing like that exists right now as far as I know.

I'd just layer gcs follow me support on top of that and support both.

The Altitude field in follow target is up to the provider. Which in reality I'm not sure shouldn't be specified in mavlink spec as AMSL home alt. But for QGC it sends AMSL home altitude.

Hwurzburg commented 4 years ago

sorry for the probably stupid question, but QGC sends its home alt (which is GPS alt right)? or vehicle's its connected to?

dogmaphobic commented 4 years ago

It sends the altitude reported by the device's GPS (same source as the coordinates).

https://github.com/mavlink/qgroundcontrol/blob/master/src/FollowMe/FollowMe.cc#L111

DonLakeFlyer commented 4 years ago

It sends the altitude reported by the device's GPS (same source as the coordinates).

Hmm forgot about that. That altitudes from a device gps is generally crap. I wonder if PX4 Firmware follow for example just disregards it. And uses vehicle home position altitude.

DonLakeFlyer commented 4 years ago

PX4 docs seems to say height above vehicle home position. Which seems to imply the alt in FOLLOW_TARGET is not used. I'll dig some more on that.

rmackay9 commented 4 years ago

OK, thanks for all the efforts on this. I'll add support for the FOLLOW_TARGET unless someone beats me to it. I'll try and get that done in the timely manner.

DonLakeFlyer commented 4 years ago

I need to do a little more digging but I'm considering adding an option to QGC for follow which allows you to specify whether you want to use vehicle home alt, versus gps alt. With likely default to vehicle home alt which is the higher quality value.

DonLakeFlyer commented 4 years ago

@rmackay9 So according to PX4 folks the follow uses the vehicle home alt internally to calc follow height. It does not use the value from the FOLLOW_TARGET which is the gcs altitude. Which make sense since the gcs alt value can be crap. Which means the FOLLOW_TARGET.alt value isn't used for anything.

lmore377 commented 4 years ago

I just came across this issue and I want to help. I have a rover vehicle and I have 2 phones with compasses, a tablet without a compass, and my laptop with a gps dongle so if there's anything I can help with just mention/reply to me.

DonLakeFlyer commented 4 years ago

@lmore377 Thanks. Since your own this thread now you'll be updated when this gets picked up again.

DonLakeFlyer commented 4 years ago

Waiting on ardupilot support

drtrigon commented 3 years ago

Any news here? Is this support included in ardupilot 4.1.0 release?

DonLakeFlyer commented 3 years ago

As far as I know not supported bny Ardupilot

rmackay9 commented 3 years ago

That's right, not included in Copter/Rover-4.1 I'm afraid.

drtrigon commented 3 years ago

That's a pitty! Thanks for the info!

Does a schedule exists on when this will get implemented?

drtrigon commented 3 years ago

The sky-viper journey video drone claims to have follow-me mode on ardupilot: https://sky-viper.com/journey/

rmackay9 commented 3 years ago

@drtrigon, yes it does but it doesn't use QGC. Instead it has a custom application that sends the follow-me commands that AP supports. AP has follow mode by the way, the issue is just that it uses different mavlink messages than QGC sends.

Anyway, we have a concrete plan now actually that Rishabh will sort this out over the next few months.

drtrigon commented 3 years ago

Anyway, we have a concrete plan now actually that Rishabh will sort this out over the next few months.

Perfect, that are very good news!

DragonOnGit commented 3 years ago

Guys, i have a problem about the follome mode. You all talk about following the Groundstation. Is there possible that can follow some other things like other vehicles, cars, phones that can provide its own position information?

lmore377 commented 3 years ago

Guys, i have a problem about the follome mode. You all talk about following the Groundstation. Is there possible that can follow some other things like other vehicles, cars, phones that can provide its own position information?

You can tell ardurover what mavlink ID to follow

https://ardupilot.org/rover/docs/follow-mode.html

DragonOnGit commented 3 years ago

Guys, i have a problem about the follome mode. You all talk about following the Groundstation. Is there possible that can follow some other things like other vehicles, cars, phones that can provide its own position information?

You can tell ardurover what mavlink ID to follow

https://ardupilot.org/rover/docs/follow-mode.html

thank you for responding. I am trying to use pixhawk+QGC to achieve it. And maybe change code for QGC to create a new mode or some button. Just like takeoff and RTL.