AP support for DJI RS2, RSC2, RS3 gimbals (maybe)

@julled,

Thanks for this very helpful link which shows how the serial-over-CAN encoding/decoding can be done.

SBUS control is possible and i have tried it using a SBUS reciever directly connected to the gimbal. This works, but as you said only direction and speed and be controlled. To unlock absolute angle control, the CAN communication is needed :slight_smile: . This will make the gimbal more useful for mapping purposes or pre-planned missions.

1 Like

With the links from @julled I’ve managed to make some progress (see branch here) and even momentarily got the gimbal to move to a specified angle.

Sadly my setup has stopped working for some reason and I suspect it is hardware related.

If others are using the Focus wheel do you always see it blinking red (a single blink) or is it green? Mine is blinking red which apparently means “Disconnected” and I think this is somehow related to my problem.

By the way, if anyone is available to help me with testing, please post the autopilot (e.g. cube orange, durandal, etc) and vehicle type (e.g. multicopter, rover, plane) you’re using and I’ll create a binary for you.

1 Like

Hi I have dji rs2 pro. My gimbal also blink red and working without problems. I am controlling it by SBUS. Only tlit, pan and roll is working. Sometimes when it doesn’t work I have to connect the servo wire from RC with SBUS signal after gimbal is turned on not earlier.

1 Like

I’ve raised a Pull Request to add support for the RS2 and RS3-Pro gimbals and it will hopefully be “merged” to “latest” this week (maybe as soon as tomorrow) so that everyone interested can more easily help testing.

There’s also a new wiki page coming that describes the physical connection and configuration.

By the way, the new driver is written in Lua which means that it could be difficult to get it to run on F4 based autopilots like the CubeBlack. Higher powered autopilots with F7 or H7 processors (like the CubeOrange, Durandal, etc) should work fine.

2 Likes

wow, so nice!

Do you think this driver could be also used with the APM antenna tracker? This would make the antennatracker easy to use from of the shelf hardware.
But, it might be tricky with the cabeling as the FC on the moving platform needs to connect to the wheel CAN port which is on the static part of the gimbal.

Amazing news!

This is a very useful addition of supported gimbals to the ardupilot community. These gimbals are really great value compared to other currently supported gimbals. I look forward to continuing testing next week, to ensure we catch all bugs. I expect we may need to evaluate the code when using in inverted mode etc…

I will also find a solution/mount for directly mounting the CAN wires to the gimbal, so the focus wheel isn’t needed.

Thanks for the great work @rmackay9 !

2 Likes

If anyone is interested in helping test, support is now in “latest” which can be installed using Mission Planner’s firmware Install screen. After pushing Ctrl-Q (on the firmware install screen) the labels below each vehicle should change to 4.4.0-DEV and then you should be able to install as per usual.

Here’s the wiki page describing the setup.

All feedback is greatly appreciated!

1 Like

Impressive work @rmackay9, do you think this could be done through a bluetooth connection or would the CAN link always be required ?

Did you get somewhere @inspired-rs2 ?

@SebastienCoponat,

Thanks! What we’ve got at the moment will only work over CAN. I don’t know if the protocol used with Bluetooth is the same or not… I suspect it’s different but I’m not sure.

Ok so I am trying to connect my RS2 pro to Cube Orange with DEV firmware from today 04.03.2023. I don’t understand how this CAN buses works and connectors. In CAN 1 port of Cube Orange I have CUAV Power Module which was working ok until I did changes for RS2 from wiki now I am trying to connect gimbal to CAN 1 port or CAN 2 port in Cube Orange but still I am getting error messages like “Mount not healthy” at least gimbal moved a little bit after connection with Cube…

I changed the parameters for “If using CAN2, set CAN_D2_PROTOCOL = 10 (Scripting), CAN_P2_DRIVER = 2 (Second driver)” but still get error messages…

I put the script file to APM/scipts on SD card. I had to create folder: scripts

If I have power module on CAN-bus 1 Should I set Gimbal on CAN_D2 ??? or they can be on the same driver P1?
How to setup this…
010.param (20.0 KB)

For now gimbal works in RC_OPTION mode I can control by my transmitter the pitch and yaw ! That’s great ! I just have to figure how to set this options with CAN to have also information from Power module about batteries. And I still get message " mount not healthy"

Ok so almost everything is perfect :slight_smile: Battery monitor is set:
CAN_P2_DRIVER:2 and CAN_D2_PROTOCOL:1 and connected to port:CAN 2 on Cube Orange and

RS2 Gimbal is connected to CAN 1 port on Cube Orange and parameters are:
CAN_P1_DRIVER:1 and CAN_D1_PROTOCOL:10

@rmackay9 please help with this: “PreArm: Mount: not healthy”

edit: Ok I found it in:
AMING_CHECK
and disabled:Camera
as I understand it’s not dangerous for flying…

@rmackay9 beside pitch, roll and yaw movment of the gimbal… do you think that camera shutter or record movie can be also controlled by this API ?

Hi I did some flights with rs2 controlled by AP. Gimball works ok. There is only problem with yaw control. I can’t make 360 move, from time to time gimbal stop to rotate. I was trying to change parameters of angles of yaw in Arducopter but that didn’t help. Gimbal nicely follow the yaw of the copter.

edit: I just noticed that gimbal stopped to move 90 degrees down in pitch.It goes only to 45 degrees. It was working earlier and now stopped. I have no idea why :frowning: That makes it useless for using under the copter for mapping :frowning: Changing parameters in Arducopter didn’t help.

edit2: I did Radio Calibration again, changed the mnt1_defl_mode to “2” and checked that gimbal works with controlling from Mission Planner by “Payload Control” in full angle and next changed mnt1_defl_mode to “3” and gimbal again has full pitch dwon 90 degrees…

For completeness: The offical protocol via CAN is described in the SDK at https://terra-1-g.djicdn.com/851d20f7b9f64838a34cd02351370894/Ronin系列/DJI_R_SDK_Protocol_and_User_Interface_EN_v2.3.pdf

1 Like

I am trying to use DJI RS2 Pro gimbal with Arducopter 4.4.4 connected by CAN. With the option MNT1_RC_RATE:0 gimbal do not follow the PAN it is always locked and option “Mount lock” doesn’t help RCx_options:163 doesn’t change anything.

With MNT1_RC_RATE :“from1-90” Follow mode works but with Herelink the moves of the gimbal are to fast There is no possibility to control gimbal precisely.

Hi @norim,

… any chance I could convince you to test using Copter-4.5 and use the 4.5 version of the script as well?

I’m spending a lot of time supporting 4.5 these days … so much so that I don’t really have much time to go back and check earlier versions. If we make fixes it will more likely be to 4.5 in any case.

Ok I will update my copter to 4.5 and check how the gimbal behave.

Ok I checked with 4.5.1…
with MNT1_RC_RATE: 0
I can control the PAN of the gimbal (In 4.4.4 in PAN gimbal always backs to oryginal position)
Follow the PAN also works.
RC11_OPTION:163 and Herelink CAM short press set to ch11 default: 1000 Active Value: 2000 moves the gimbal in PAN to the right around 30 degrees. This option doesn’t change “Mount lock” Follow always on.
Gimbal moves are to fast I tried to slow them in gimbal parameters but that doesn’t help

with MNT1_RC_RATE:60
I can control the movement of the PAN and TILT precisely but gimbal is always in “Lock” mode I can’t force it to “Follow” mode in PAN or TILT. Rx_OPTION:163 doesn’t work, doesn’t change anything.

Hi @norim,

Thanks for testing, I’ve added this to the 4.5 issues list and I’ll test on my gimbal.

Hi @norim,

I checked the driver and also my own gimbal and the driver does not support follow-mode during yaw rate control. So when using RC rate control (e.g. MNT1_RC_RATE = 30). RC yaw rate control is always “lock” mode (aka earth-frame, does not rotate with the vehicle).

I’ve created an enhancement request to add support for yaw rate control using follow. In case it matters, I’m sure this driver has never supported RC yaw rate control in “follow” mode. I suspect during the development we couldn’t figure out a way to make it work. It may even be a limitation of the gimbal itself.

As you say, during angle control mode both “lock” and “follow” modes are supported because AP does the conversion.

I’ve also created a wiki issue to warn users of this short coming. DJI RS2/RS3 should warn that RC yaw control does not support "follow" · Issue #5945 · ArduPilot/ardupilot_wiki · GitHub

1 Like