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

Pan and Tilt of camera gimbal #14

Open
BkMak16 opened this issue Jul 4, 2020 · 12 comments
Open

Pan and Tilt of camera gimbal #14

BkMak16 opened this issue Jul 4, 2020 · 12 comments

Comments

@BkMak16
Copy link

BkMak16 commented Jul 4, 2020

The Pan and Tilt of camera gimbal works fine as expected on the ground with the def setServo.
However in flight, the servo 8 which pan's the gimbal, now yaw's the craft.

Land again, this works perfectly,

So now the craft doesn't pan the camera but does tilt the camera,

If you yaw normally the craft yaw's twice, either with the setServo direction or against the direction.
Tried using the Mav ROI instead, that doesn't move the gimbal at all.

If the gimbal pan was set to an awkward angle on take off, this cannot be corrected in flight, even though the tilt can.

Any ideas on how to fix this?

@The1only
Copy link
Collaborator

The1only commented Jul 4, 2020

Seems the gimbal must be inn YawFollow mode, and not in FREE mode.
It is suppose to change mode automatically.

Try changing the code like this and test:

DroneModel.java line 1477...

/********************************************
* Motion implementation *
********************************************/

void do_set_Gimbal(float channel, float value)
{
    Rotation.Builder builder = new Rotation.Builder().mode(RotationMode.ABSOLUTE_ANGLE).time(2);
    float param = (value-(float)1500.0)/(float)5.5;
    if (channel == 9) {
        builder.pitch(param);
    } else if (channel == 8) {
        builder.yaw(param);
    }
    if (mGimbal == null) {
        return;
    }

    mGimbal.setMode(GimbalMode.FREE,djiError -> {
        if (djiError != null)
            parent.logMessageDJI("Error: " + djiError.toString());
    });

    mGimbal.rotate(builder.build(), djiError -> {
        if (djiError != null)
            parent.logMessageDJI("Error: " + djiError.toString());
    });
    util.safeSleep(500);
}

Please report results ...

@The1only
Copy link
Collaborator

The1only commented Jul 4, 2020

It might not be that easy:

FREE The gimbal can move independently of the aircraft's yaw. In this mode, even if the aircraft yaw changes, the camera will continue pointing in the same world direction. This mode is only available for the Ronin-MX when the M600 or M600 Pro landing gear is retracted.
FPV The gimbal's work mode is FPV mode. In this mode, the gimbal yaw will follow the aircraft's heading, and the gimbal roll will follow the RC's roll channel value. The pitch will be available to move. This mode is only available for the Ronin-MX when the M600 landing gear is retracted.
YAW_FOLLOW The gimbal's work mode is such that it will follow the yaw. In this mode, the gimbal yaw will be fixed, while pitch and roll will be available to move.
UNKNOWN The gimbal's work mode is unknown.
RELATIVE_ANGLE The angle value, when the gimbal is rotating, relative to the current angle.
ABSOLUTE_ANGLE The angle value, when the gimbal is rotating, relative to 0 degrees (aircraft heading).  For Inspire 1, using X3, X3 Zoom and Z3 cameras will be relative to true north. Using X5, XT and X5R will be relative to the aircraft heading. For Inspire 2, using X4S and X5S cameras will be relative to true north. Using X7 and Z30 will be relative to the aircraft heading.
SPEED Rotate the gimbal's pitch, roll, and yaw in SPEED Mode. The direction can either be set to clockwise or counter-clockwise. For Phantom 3 Professional, Phantom 3 Advanced and Phantom 3 Standard, roll and yaw rotations are not available. For Inspire 1, Inspire Pro and M100, pitch, roll and yaw rotations are available. For Osmo, roll rotation is not available. The yaw angleVelocity of DJIGimbalSpeedRotation range is (-120, 120).

@BkMak16
Copy link
Author

BkMak16 commented Jul 4, 2020

Will do new builds and see what works best.

Thanks

@BkMak16
Copy link
Author

BkMak16 commented Jul 8, 2020

Okay,

Last question then I'll be able to give you my findings.

Is there a way to change the modes (sports, p-mode and tripod) without using the slider on the controller. An app button, setting or line of code?

@BkMak16
Copy link
Author

BkMak16 commented Jul 8, 2020

On the first bootup:

P-Mode or Tripod:
Collision Detection : Front and Rear Only
Movement (X,Y,Z) : Yes
Yaw : No
Gimbal : Tilt and Pan
User Controller Input : No

Sport:
Collision Detection : No
Movement (X,Y,Z) : Yes
Yaw : No
Gimbal : Tilt and Pan
User Controller Input : No

After Switching Modes:

P-Mode:
Collision Detection : Front and Rear Only
Movement (X,Y,Z) : No
Yaw : No
Gimbal : Tilt
Pan makes drone Yaw
User Controller Input : Yes

Tripod:
Collision Detection : Full
Movement (X,Y,Z) : No
Yaw : No
Gimbal : Tilt
Pan makes drone Yaw
User Controller Input : Yes

Sports:
Collision Detection : No
Movement (X,Y,Z) : No
Yaw : No
Gimbal : Tilt
Pan makes drone Yaw
User Controller Input : Yes

On all modes and first boot, Gimbal Pan works properly only on the ground.

There is no way to get movement and full collision detection. To get full detection you must switch modes even if booted in tripod as you only get front and rear, switching modes causes the loss of movement and gimbal pan. To regain these, the drone must be rebooted.

Yaw does not respond in any mode regardless of gimbal build. A form of Yaw is after a mode switch the pan becomes the Yaw, leaving no way on panning.

A way to solve the everything except for the Yaw, is to do the system check that happens when switching to tripod which activates the remaining sensors, if the controller is booted/connected already in tripod mode so that you don’t have to switch out of tripod and back in to get the sensors, thereby losing movement.

@BkMak16
Copy link
Author

BkMak16 commented Jul 8, 2020

Rosseta.docx

Heres the WordDoc version

@The1only
Copy link
Collaborator

My workaround is to rotate the entire drone, and only use pitch on the camera controller. One can move in any direction while pointing the head in another.

@The1only
Copy link
Collaborator

I have investigayed a bit more, on Inspire this does not happen, seems I can not get around it on the Mavics ...

@robbiedood
Copy link
Contributor

Dear rosettadrone friends and @The1only ,

I was wondering if someone tried DroneKit's Gimbal control function. We are trying to use DroneKit to change the pitch of gimbal, but not very sure if it is compatible with rosettadrone.

-- Luke

@The1only
Copy link
Collaborator

The1only commented Jan 26, 2021 via email

@BkMak16
Copy link
Author

BkMak16 commented Jan 26, 2021

Hopefully soon I'll be able to get back to working on the Mavic.

@BkMak16
Copy link
Author

BkMak16 commented Aug 26, 2021

Might have a solution here.

https://developer.dji.com/api-reference/android-api/Components/MobileRemoteController/DJIMobileRemoteController.html

Alternative ability to control the sticks instead?

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

No branches or pull requests

3 participants