qgroundcontrol icon indicating copy to clipboard operation
qgroundcontrol copied to clipboard

Geofence / Rally

Open flybrianfly opened this issue 3 years ago • 1 comments

I have a flight control system and MAV Link library, which wraps around the C MAV Link implementation. Reporting autopilot as MAV_AUTOPILOT_GENERIC with the following capabilities:

  • MAV_PROTOCOL_CAPABILITY_PARAM_FLOAT
  • MAV_PROTOCOL_CAPABILITY_MISSION_INT
  • MAV_PROTOCOL_CAPABILITY_MAVLINK2
  • MAV_PROTOCOL_CAPABILITY_MISSION_FENCE
  • MAV_PROTOCOL_CAPABILITY_MISSION_RALLY

Using QGC v4.1.5, I'm able to upload fence vertices and rally points to my autopilot. Upon upgrading to v4.2.0, I can only upload mission plans and the fence and rally tabs are shown, but greyed out and non-clickable. On Windows 10.

Expected Behavior

Expect to be able to upload fence vertices and rally points.

Current Behavior

Fence and rally tabs are shown, but greyed out and non-clickable.

System Information

When posting bug reports, include the following information

  • Operating System: Windows 10
  • QGC Version: 4.2.0
  • QGC build: stable
  • Flight Controller: custom / generic

flybrianfly avatar Apr 21 '22 01:04 flybrianfly

"greyed out" generally caused by qmls enabled property which in this case controlled in by

                    QGCTabButton {
                        text:       qsTr("Fence")
                        enabled:    _geoFenceController.supported
                    }

and geoFenceController.supported is at geofencecontroller.cc

bool GeoFenceController::supported(void) const
{
    return (_managerVehicle->capabilityBits() & MAV_PROTOCOL_CAPABILITY_MISSION_FENCE) && (_managerVehicle->maxProtoVersion() >= 200);
}

however this part is not changed for 5 years. So this shouldnt be.

As a sarting point, we could look at the logs.

Vehicle geofence capabilities are logged here

Can you try again, in both versions, with vehicleLog open, and upload the logs here ?

mnumanuyar avatar Aug 31 '22 12:08 mnumanuyar

No feedback from the user and likely a implementation problem in the flight control system.

booo avatar Nov 06 '22 13:11 booo

@mnumanuyar, I had a flight control system set up to test this and get the logging data today. The issue is still present. Attached are logs from v4.1.5 (log_v415) and v4.2.4 (log_v424). It looks like v4.1.5 successfully sees the autopilot capabilities messages that we are sending and v4.2.4 does not. Please let me know what additional information I can provide while I have this set up. log_v415.txt log_v424.txt

flybrianfly avatar Nov 15 '22 00:11 flybrianfly

@booo, please re-open, this is still an issue. It took us a bit to set the test back up.

flybrianfly avatar Nov 15 '22 00:11 flybrianfly

You must be using mavlink 2 in latest qgc to enable fence and rally points, there's a peculiar condition, you have to first power the vehicle and then start the QGC, most prob a bug in qgc

Yatin-Khurana avatar Nov 15 '22 03:11 Yatin-Khurana

The vehicle was started and running first in both of these tests. I'm reporting v2 support with the MAV_PROTOCOL_CAPABILITY_MAVLINK2 flag and in the v4.1.5 log file, you can see that QGC sees mavlink v2 as supported on line 22 as "[D] at C:\projects\qgroundcontrol\src\Vehicle\Vehicle.cc:1188 - ""Vehicle supports Mavlink 2.0"". It's weird, looking at the v4.2.4 log file, it's like QGC isn't picking up any of the capabilities flags that I'm sending.

flybrianfly avatar Nov 15 '22 03:11 flybrianfly

Is this a modified fork you are using ? Try on the latest stable branch

Yatin-Khurana avatar Nov 15 '22 03:11 Yatin-Khurana

It's the latest stable on Windows 10. The older v4.1.5 is downloaded from the GitHub release.

flybrianfly avatar Nov 15 '22 03:11 flybrianfly

Did you investigate the reason for the timeout messages? As far as I can see there are timeouts for the request of the AUTOPILOT_VERSION ( #148 ):

...
"_waitForMavlinkMessage msg:timeout 148 1000"
...

Maybe you should enable logging for InitialConnectStateMachineLog too to get a better overview about what is happening.

Some pointers to your code where you implement the initialization of your FC would be nice too.

booo avatar Nov 15 '22 09:11 booo

Thanks for the hint. Based on the output from the log, it looks like older versions of QGC were using the MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES message and newer versions are only using the MAV_CMD_REQUEST_MESSAGE to request the autopilot capabilities. Our flight software was responding to the now deprecated MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES message, but not the newer MAV_CMD_REQUEST_MESSAGE.

flybrianfly avatar Nov 16 '22 03:11 flybrianfly

Just wanted to confirm that I added the appropriate response to the MAV_CMD_REQUEST_MESSAGE and fence / rally point options are now available in QGC v4.2.4. Thanks again.

flybrianfly avatar Nov 16 '22 03:11 flybrianfly