Skip to content
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

AP_Scripting: mount-djirs2: fix reporting issues #24461

Closed
wants to merge 2 commits into from

Conversation

tpwrules
Copy link
Contributor

Decently recent firmware for the RS2 sends replies back in a slightly different format than expected by the script. I've corrected the script to parse the new packets correctly but now it will not work with the old style. The documentation is updated to inform users to update.

I also fixed the reporting of angles as it was broken by a recent change for reasons I can't determine. I made sure that the reported angles and directions match the drone frame (positive roll right/clockwise from rear, positive pitch up/clockwise from left, positive yaw right/clockwise from top) in both right side up and upside down modes.

cc: @rmackay9 who wrote the original script

tpwrules added 2 commits July 31, 2023 16:36
DJI R SDK version 2.2.0.5 released on October 30, 2020 added CmdSet and
CmdID bytes to reply frames before the data segment which need to be
skipped when parsing replies.

Tested with gimbal firmware 01.04.00.20 and 01.05.00.20 (latest version).
Commit 380c201 swapped roll and pitch
for unknown reasons, this fixed order agrees with the documentation and
testing on a real gimbal.

Also correct reporting of yaw when upside down mode is used so that the
reported yaw matches the targeted yaw.
@rmackay9
Copy link
Contributor

rmackay9 commented Dec 4, 2023

Hi @tpwrules,

Sorry for taking so long to reply to this PR. I've created a modified version here #25692 which includes your changes (mostly) but also maintains support for the legacy firmware. Could you help test it works with the latest gimbal firmware?

Also you might want to pull in the last commit from this branch and then set DJIR_DEBUG = 1 so that we can double check the length of the packets is indeed 2 larger than in the legacy firmware. The packet length are output to the GCS messages tab.

Note that I haven't included the change to the report roll and pitch angles. I don't think those changes were correct. I've tested and my gimbal moves correctly. I suppose it could be that the bug is in the gimbal itself and that the latest firmware has swapped the roll and pitch reporting fields.

@tpwrules tpwrules closed this Dec 13, 2023
@tpwrules tpwrules deleted the fix-djirs2-driver branch December 13, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants