mavlink / qgroundcontrol

Cross-platform ground control station for drones (Android, iOS, Mac OS, Linux, Windows)
http://qgroundcontrol.io
3.26k stars 3.59k forks source link

Gimbal manual control doesn't work #11956

Open eshcheglov opened 3 weeks ago

eshcheglov commented 3 weeks ago

Steps to Reproduce:

Follow the official instruction

  1. Set MNT_MODE_OUT=AUX
  2. Set MNT_MODE_IN=Auto
  3. Configure Gimbal Servo using Actuators tab:
    PWM:       200Hz
    AUX 5:     "Gimbal Pitch"
    Disarmed:  1000
    Minimum:   1100
    Maximum:   1900
  4. Verify that gimbal servo is working using Actuator Testing
  5. Set MNT_MAN_PITCH=AUX5
  6. In Joystick -> Button Assigment tab set Gimball Up and Gimball Down to some buttons on connected USB joystick

Gimbal work automatically:

System Information

julianoes commented 3 weeks ago

Can you try with PX4 v1.15.0 and/or with MNT_MODE_IN set to MAVLink gimbal v2?

eshcheglov commented 3 weeks ago

Can you try with PX4 v1.15.0 and/or with MNT_MODE_IN set to MAVLink gimbal v2?

Nothing changed

UPD: I noticed that a Gimbal control icon appeared in QGC, but there's no response to any of the options.

Screenshot from 2024-09-30 19-32-52

eshcheglov commented 2 weeks ago

but there's no response to any of the options.

Alright, after arming, the gimbal responds to the Center and Tilt 90 buttons, correctly adjusting its position. However, there's still no response to the joystick buttons

julianoes commented 2 weeks ago

Aha, that's good news! Which gimbal is that? It sounds like angle input works but angular velocity does not. I wonder if the problem is on the PX4 side converting this.

I remember looking into this a while ago. Could you double check with PX4 v1.15.0?

julianoes commented 5 days ago

Ok, I believe the issue here is that your gimbal output (PWM output) doesn't support angular rate commands but only angles. So we should probably add that to the PX4 driver.

The logic is missing here: https://github.com/PX4/PX4-Autopilot/blob/f55c3b890b0bd598084233e44875c3f3076931fb/src/modules/gimbal/output_rc.cpp#L68-L82

eshcheglov commented 4 days ago

Hi!

Aha, that's good news! Which gimbal is that?

It's a custom build based on a standard PWM Servo called PDI-1181MG produced by "JX-SERVO" It has the following parameters:

Dead band: 2μs
Working frequence: 1520μs / 300hz
Motor: core motor
Operating Voltage: DC4.8~6.0 V
Operating Speed (4.8V): 0.13sec/60°
Operating Speed (6V): 0.11 sec/60°
Stall Torque (4.8V): 3.0kg.cm
Stall Torque (6V): 3.5 kg.cm 

Servo rail is powered by 5V BEC

I remember looking into this a while ago. Could you double check with PX4 v1.15.0?

Yeah, all current test results is from v1.15.0

Ok, I believe the issue here is that your gimbal output (PWM output) doesn't support angular rate commands but only angles.

I achieved some minimal (almost invisible, but still) response to joystick input after changing MNT_RANGE_PITCH from default 90 to 20 deg. However, delay between button press and reaction is so long, and servo angle change is so small, that I need to press "down" button at least 15 times with 2 sec delay between every press to get 20 deg on gimbal. Unfortunately, I still can't understand what this parameter actually does..

MaEtUgR commented 21 hours ago

In Joystick -> Button Assigment tab set Gimball Up and Gimball Down to some buttons on connected USB joystick

FYI in my testing with a MAVLink gimbal protocol v2 output the gimbal up/down commands from the joystick only move the gimbal by 1°. I'd need to check what the implementation on ground station side is bug I thought it takes the current gimbal attitude as per it's telemetry and just adds a tiny amount on top and you have to actually keep on spamming the button on repeat to see the movement. To be verified but that's an observation I made. The "gimbal center" joystick button command sends an attitude command to level out and executes nicely if no conflicting commands are coming simultaneously.