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

Gimbal manual control doesn't work #11956

Closed
eshcheglov opened this issue Sep 27, 2024 · 12 comments · Fixed by #12049
Closed

Gimbal manual control doesn't work #11956

eshcheglov opened this issue Sep 27, 2024 · 12 comments · Fixed by #12049
Assignees

Comments

@eshcheglov
Copy link

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
  1. Verify that gimbal servo is working using Actuator Testing
  2. Set MNT_MAN_PITCH=AUX5
  3. In Joystick -> Button Assigment tab set Gimball Up and Gimball Down to some buttons on connected USB joystick

Gimbal work automatically:

  • It change position after arming
  • It changing position relatively to frame position if MNT_DO_STAB is enabled.
    So I can assume that gimbal is actually working, but I can't manipulate it manually for some reason

System Information

  • Operating System: Ubuntu 24.10
  • QGC Version: 4.4.0 (AppImage)
  • QGC build: stable
  • Flight Controller: Pixhawk 6c mini
  • Flight Controller FW: PX4 Autopilot 1.14.3
@julianoes
Copy link
Contributor

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

@eshcheglov
Copy link
Author

eshcheglov commented Sep 30, 2024

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
Copy link
Author

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
Copy link
Contributor

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
Copy link
Contributor

julianoes commented Oct 17, 2024

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
Copy link
Author

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
Copy link
Collaborator

MaEtUgR commented Oct 21, 2024

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.

@julianoes
Copy link
Contributor

julianoes commented Oct 29, 2024

@eshcheglov I can now reproduce this. When you check the "Repeat" checkbox next to the gimbal commands it starts working, however, it's still painfully slow.

@Davidsastresas should we just increase the step size to make this faster somehow?

It's somewhat manageable with steps of 5 degrees instead of 1 but it's still awkward and not smooth.

I wonder if we should instead use the angular velocity API for this, so when you press it down it will start the movement and when you release the button it will stop the movement.

@MaEtUgR
Copy link
Collaborator

MaEtUgR commented Oct 30, 2024

I wonder if we should instead use the angular velocity API for this, so when you press it down it will start the movement and when you release the button it will stop the movement.

Sounds like a better approach yes. I think for a good user experience, you need to be able to quickly bring it up to level, straight down and possibly also 45° forward down and then fine adjust with whatever button or rocker you have. The speed for the adjustment needs to be tied to focal lengt/zoom level.

@julianoes
Copy link
Contributor

The speed for the adjustment needs to be tied to focal lengt/zoom level.

Right. I remember there was a discussion about this at some point. I wonder if we need to add a flag to MAVLink that allows scaling the angular velocity according to zoom, so that the camera/gimbal itself can adjust it.

@eshcheglov
Copy link
Author

BTW, the on-screen gimbal control works like a charm. I'm referring to the touchscreen gesture approach, where touching the top or bottom of the screen moves the gimbal quickly and across a wide range.

@julianoes
Copy link
Contributor

@eshcheglov hm, can you maybe provide a video regarding the touchscreen gesture problem? I'm not sure I understand what you mean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants