RosettaDrone / rosettadrone

MAVlink and H.264 Video for DJI drones
BSD 3-Clause "New" or "Revised" License
308 stars 117 forks source link

Mavic 2 Pro: No Takeoff or Video in QGC #186

Closed kylenietfeld closed 1 year ago

kylenietfeld commented 1 year ago

Describe the bug

Hello, this may not be a bug but I am having trouble getting my Mavic 2 to do a takeoff or see video from the camera from QGroundControl.

Takeoff: I am able to succesfully connect to the Mavic 2 with RosettaDrone and it connects to QGC (the light is green and I can see some updating parameters such as battery life and # of satellites connected). QGC says 'Ready to Fly', however, when I try to takeoff, arm, or do an individual motor test, I get an error (one example attached). Is there something obvious that I am missing? In my attempts, I did not have a higher number of GPS satellites connected.

Video: I tried the UDP options listed in QGC.

Any help would be greatly appreciated!

Steps To Reproduce

No response

Screenshots

image

Drone Model

Mavic 2 Pro

Smartphone Model

- Model:TCL430M
- Android version: 13

Additional context

No response

kylenietfeld commented 1 year ago

Also, the buttons on the left side of the screen of the RD app (besides the home button) are not operational for me. I'm guessing they should do something when clicked? image

kripper commented 1 year ago

Have you checked the "Hacking on Rosetta Drone" guide?

kylenietfeld commented 1 year ago

I have. I calibrated the compass using the DJI Go app and it said the drone is Ready to Go. Then, I connect with Rosetta and it auto connects to QGC.

Rosetta should support the Mavic 2 Pro, correct? Is there anything else I need to do with my M2P before a takeoff command can be called? I noticed that QGC says there is 100% loss rate for the MAVlink commands, I'm sure that's part of the problem, but I'm not sure why. Is there any settings on QGC that need to be changed from the default settings?

I got the takeoff and land to work my Mavic Mini. Still trying to get video to work

kripper commented 1 year ago

I would check the logcat using Android studio. Maybe your firewall is blocking the UDP packets?

kylenietfeld commented 1 year ago

Thanks for the suggestion! I noticed in the logcat in Android Studio that the line: sq.rogue.rosettadrone E/UDT-JNI: stopped udp

kept recoccuring during runtime. Looks like the problem but do you know what it means? I ran this with my firewall turned off.

stw2nf commented 1 year ago

I am having this same problem with a Mini 2

kylenietfeld commented 1 year ago

I noticed the log message when I send a takeoff command from QGC to my M2P is rcmode == forbiddenModeSwitch == POSITION_ONE. I don't see any other github issues with this message. Does anybody understand what this means?

The1only commented 1 year ago

You have not unlocked Rosettadrone.Press the small lock up in the right corner.Best regardTerje Nilsen9Tek ASNorwayOn 10 Oct 2023, at 00:19, kylenietfeld @.***> wrote: Also, the buttons on the left side of the screen of the RD app (besides the home button) are not operational. I'm guessing they should do something when clicked?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

kripper commented 1 year ago

You have not unlocked Rosettadrone.Press the small lock up in the right corner

Maybe it's not that. I would suggest to check the code. I remember there were some security restrictions (preventing some mode combinations) for specific models and comments explaining the reason.

Of course, something very simple to find and modify if you see the code.

People (including me) are a little scared to take a look at the code the first time. Then, they realize it's actually very easy to locate and change it.

kylenietfeld commented 1 year ago

I am able to verify the video stream is being sent. I was able to see the video stream using gstreamer using the following command in the terminal:

gst-launch-1.0 -v udpsrc port=5600 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! videoconvert ! autovideosink

I'm not sure why I am unable to see the video using QGC, but I don't need QGC for my application.

kripper commented 1 year ago

rcmode == forbiddenModeSwitch ==

Search this string in the source code. It's the restriction I mentioned above.

kylenietfeld commented 1 year ago

Thanks for your help in this! Can you explain a bit more about this (or point me to more information)? I saw that line in the code, but I didn't think there is any thing I can do about it. Am I able to remove it from the code? What purpose does this switch have?

kripper commented 1 year ago

I'm not sure. Isn't there a comment? Why didn't you copy/paste the code you found?

kylenietfeld commented 1 year ago

when I search that string in this repository it returns these lines of code:

private HardwareState.FlightModeSwitch rcMode = HardwareState.FlightModeSwitch.POSITION_ONE; -- 183 | private static HardwareState.FlightModeSwitch forbiddenModeSwitch = HardwareState.FlightModeSwitch.POSITION_ONE; //…   279 | if (m_aircraft == null \|\| !m_aircraft.isConnected()) {   286 | if (m_model == null) {   292 | forbiddenModeSwitch = HardwareState.FlightModeSwitch.POSITION_THREE;   296 | useMissionManager = m_model == Model.MAVIC_MINI 297 | \|\| m_model == Model.DJI_MINI_SE 298 | \|\| m_model == Model.DJI_MINI_2

Is this what you were referring to? Sorry, I am new to this.

kripper commented 1 year ago

Yes. Somehow HardwareState.FlightModeSwitch.POSITION_THREE is forbidden under certain conditions. I don't know why. Maybe it's described in the commit or @The1only knows why. Please use code formatting in the future. The code block also looks incomplete. Is useMissionManager used for this matter?

The1only commented 1 year ago

The mode switches has different positions on Inspire 1, so pay attention to its setting.

kripper commented 1 year ago

Actually, if I remember correctly, I had to disable this restriction for the mini versions, but I'm not sure. You will have to check the code. Maybe we should just apply this restriction to certain models instead of apply it to all by default.

@The1only can you please explain more in detail why the mode needs to be restricted?