-
-
Notifications
You must be signed in to change notification settings - Fork 510
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
ArduPilot - Problem identified that may be causing the mission module to fail (fly_mission example) #2110
Comments
Thanks @trolledbypro for looking into this! 🚀 I think I would be in favour of a third version: drop gimbal v1 entirely and always assume v2. There are many problems with the detection anyway. One that I learn here is that the But on top of that, the detection we have in the I don't know of a single drone that uses Gimbal v1, and v2 has been out there for years. Maybe it is time to drop v1 entirely. @julianoes what do you think? |
Hey @JonasVautherin, By looking into the Gimbal module code and at my debugging, it seems that the Gimbal module init and enable methods are not being called. I believe this is the case because Wireshark does not detect a MAV_CMD_REQUEST_MESSAGE being sent from to the AP. Even if the message is unsupported, it would still be sent. I am not sure which thread calls these methods, I don't think it's the main thread because I could not step into these methods: MAVSDK/src/mavsdk/plugins/gimbal/gimbal_impl.cpp Lines 29 to 49 in fadfe22
These methods establish the gimbal version. The absence of these methods being called is causing a timeout which creates an assumption that gimbal v1 is present: MAVSDK/src/mavsdk/plugins/gimbal/gimbal_impl.cpp Lines 197 to 208 in fadfe22
Here is the timeout code that sets it to v1. MAVSDK/src/mavsdk/plugins/mission/mission_impl.cpp Lines 126 to 131 in fadfe22
|
Hmm even if you instantiate a |
Hmm, so the way we currently detect gimbal v2 is maybe not working with Ardupilot? But that brings be back to my question above: no need to fix the detection for Ardupilot if we just default to v2 and drop v1 entirely. @julianoes what do you say? |
I talked with Julian, and he agrees that we should drop gimbal v1. I won't be able to do that before 2 weeks because I am going on holidays, so... @trolledbypro if you want to do it before then, feel free! Just remove the detection and default to v2, and you can also remove the v1 implementation files. Really it shouldn't be very hard. Otherwise I'll give it a shot when I'm back. Does that work for you @trolledbypro? |
@JonasVautherin I'll make a branch in my fork and get to work, should be doable for me (especially within 2 weeks) |
Amazing, keep me posted! |
I did more debugging, and setting up a gimbal on SITL allowed gimbal version 2 to be successfully detected (I am dumb and forgot the -M flag :( ). However, I still am getting a mission unsupported message even with gimbal version 2. MAVSDK/src/mavsdk/plugins/mission/mission_impl.cpp Lines 1288 to 1312 in e7657c2
MAVSDK/src/mavsdk/plugins/mission/mission_impl.cpp Lines 459 to 480 in e7657c2
It looks like it has not yet been implemented to work as a mission item. This is something I maybe able to fix by adding the support into ArduPilot. I will discuss with the devs there. |
These are two issues I made in ArduPilot that should make gimbal control work with MAVSDK (until I find new bugs): |
Hello, I have found a possible cause of this issue of the mission module failing in ArduPilot.
Using Wireshark, I analyzed the network traffic between my ArduPilot SITL (running inside a WSL2 Docker container that runs the latest ArduPilot Docker image) and the MAVSDK example (running inside WSL2 as I was having issues running it in Windows 10). My MAVSDK library and my fly_mission binary were built in debug mode using CMake through CMake Tools in VSCode (using VSCode WSL Remote session).
Here is my terminal output:
There is a debug message saying the gimbal version is v1, and that the mission is unsupported.
Examining Wireshark, the last message sent before the MISSION_ACK message containing the MAV_MISSION_UNSUPPORTED payload was MAV_CMD_DO_MOUNT_CONFIGURE (204).
When gimbal angles are defined in a mission_item, the gimbal version is verified:
MAVSDK/src/mavsdk/plugins/mission/mission_impl.cpp
Line 460 in fadfe22
We then use the version above and send a version specific message containing the gimbal configuration. Below, we see that the unsupported message is sent if the gimbal version is assumed to be v1, as is the case in my console output:
MAVSDK/src/mavsdk/plugins/mission/mission_impl.cpp
Lines 1188 to 1221 in fadfe22
It appears that MAVSDK is not finding out the supported gimbal version. Gimbal v1 is deprecated in ArduPilot as of version 4.3. Wireshark shows that no GIMBAL_MANAGER_INFORMATION (280) messages were sent from the AP and no MAV_CMD_REQUEST_MESSAGE (512) message from MAVSDK requesting the gimbal version was sent. The GIMBAL_MANAGER_INFORMATION message is what the gimbal module uses to set the gimbal version.
I propose the following two solutions. I think the latter is more inclusive to more ArduPilot versions but the former could be implemented quicker:
What do you all think?
The text was updated successfully, but these errors were encountered: