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

RC PWM joystick buttons override #10431

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

zdanek
Copy link
Collaborator

@zdanek zdanek commented Sep 22, 2022

This PR realizes #10430
Adds sending PWM values on Joystick press and release. Very useful.
Review would be appreciated :)

@mrpollo
Copy link
Member

mrpollo commented Oct 4, 2022

Hey @dagar / @bkueng can you please help me review this one?

@fredowski
Copy link
Contributor

@zdanek : This breaks the regression?

@zdanek
Copy link
Collaborator Author

zdanek commented Oct 6, 2022

@fredowski fixed all issues with compiling and build

@marshallwicker
Copy link

I ran this version of QGroundControl with a Pixhawk 5x and Pixhawk 6c. Very useful feature for our confetti cannon trigger!

@zdanek
Copy link
Collaborator Author

zdanek commented Oct 12, 2022

I ran this version of QGroundControl with a Pixhawk 5x and Pixhawk 6c. Very useful feature for our confetti cannon trigger!

OMG @marshallwicker thank you for your support. Is there any chance to see a video with this cannon? :D
Can be privately with a link on my mail :)

@dakejahl
Copy link
Contributor

Can you provide a little bit more info on how you tested? Hardware (CubeOrange / Pixhawk4 for example) and software (Ardupilot / PX4 and release version). I have some feedback I will leave a review but would like to be able to test as well I'm at it. Thanks for the contribution this seems like a really useful feature.

Comment on lines 146 to 172
QGCTextField {
width: ScreenTools.defaultFontPixelWidth * 10
implicitHeight: ScreenTools.implicitTextFieldHeight
visible: true
validator: IntValidator { bottom:1000; top: 2000}

Component.onCompleted: {
if(_activeJoystick) {
text = parent._getButtonPwm(modelData, true)
}
}
onEditingFinished: parent._setButtonPwm(modelData, true, text)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This text field needs to update when the channel selection changes. For example if you set it up for Channel 10, and then use the drop down to select Channel 11, the PWM values in "low" and "high" will not get applied but they still show up in the text fields. These text fields should reset to 0 when the channel selection changes.

@marshallwicker
Copy link

I ran this version of QGroundControl with a Pixhawk 5x and Pixhawk 6c. Very useful feature for our confetti cannon trigger!

OMG @marshallwicker thank you for your support. Is there any chance to see a video with this cannon? :D Can be privately with a link on my mail :)

I totally would, but it was just a proof of concept test on the bench to see if it would trigger our PWM switch (basically a pwm controlled relay). If I can find another confetti cannon, I’ll record it!

@marshallwicker
Copy link

Can you provide a little bit more info on how you tested? Hardware (CubeOrange / Pixhawk4 for example) and software (Ardupilot / PX4 and release version). I have some feedback I will leave a review but would like to be able to test as well I'm at it. Thanks for the contribution this seems like a really useful feature.

I tested on the Holybro Pixhawk 5x and Holybro Pixhawk 6c using PX4-Autopilot. I only tested one channel though! I will test further tomorrow.

_assignableButtonActions.append(new AssignableButtonAction(this, _buttonActionEmergencyStop));

// TODO(bzd) take channel nos from config, especially max
for (int ch = 8; ch <= 16;ch++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (int ch = 8; ch <= 16;ch++) {
for (int ch = 9; ch <= 16;ch++) {

Channels 1-8 are PWM MAIN

@dakejahl
Copy link
Contributor

I tested on the Holybro Pixhawk 5x and Holybro Pixhawk 6c using PX4-Autopilot

Stupid question from me as I haven't used newer PX4 in a long time. I just got a Pixhawk 5X and am using PX4 1.13. I can enable FMU OUT channel 3 (PWM AUX 3) via QGC Actuators menu and control them via slider no problem, but this button feature isn't working. I have pre-arm mode set to always and I have even tested while armed with no success. I do see uORB rc_input update when I press the button so I know the messages are getting through, PX4 is just not acting on that data. And ideas?

@marshallwicker
Copy link

I tested on the Holybro Pixhawk 5x and Holybro Pixhawk 6c using PX4-Autopilot

Stupid question from me as I haven't used newer PX4 in a long time. I just got a Pixhawk 5X and am using PX4 1.13. I can enable FMU OUT channel 3 (PWM AUX 3) via QGC Actuators menu and control them via slider no problem, but this button feature isn't working. I have pre-arm mode set to always and I have even tested while armed with no success. I do see uORB rc_input update when I press the button so I know the messages are getting through, PX4 is just not acting on that data. And ideas?

I’m not sure, but I’ll check again tomorrow to see if I did anything out off the ordinary. I am building PX4 from master locally, but I haven’t changed my submodule for Mavlink, so I can’t see why that would be an issue.

@zdanek
Copy link
Collaborator Author

zdanek commented Oct 14, 2022

I tested on the Holybro Pixhawk 5x and Holybro Pixhawk 6c using PX4-Autopilot

Stupid question from me as I haven't used newer PX4 in a long time. I just got a Pixhawk 5X and am using PX4 1.13. I can enable FMU OUT channel 3 (PWM AUX 3) via QGC Actuators menu and control them via slider no problem, but this button feature isn't working. I have pre-arm mode set to always and I have even tested while armed with no success. I do see uORB rc_input update when I press the button so I know the messages are getting through, PX4 is just not acting on that data. And ideas?

@dakejahl I'm not sure is this related. The mechanism behind my feature it to use RC Override mavlink command to override RC channel value. I'm not sure how AUX channels work since I have only Pixhawk with Ardupilot.
Not sure if this is to be used / connected with AUX outputs. Joystick button press is translated to certain PWM value on RC channel (currently one of 8 to 16). That's all. I don't know if this is to be used with AUX output. Maybe you can explain it.

Thank you.

@marshallwicker
Copy link

After thinking about this further, this does feel like a bit of a workaround. Instead of directly assigning the outputs of the flight controller to a PWM output, I think we should find a way to map it to an actuator output (RC AUX 1-6) so it can be configured in the actuator menu. The computer joystick should be configured similar to an RC controller where the buttons become analog outputs and can be assigned to an RC AUX output.
I think this is a great solution, but it’s strongly coupled to flight controllers that have at least 16 outputs. To keep this abstract and follow the control scheme, we shouldn’t directly assign outputs to a high or low pwm value. We should just make them capable of transmitting on the RC Aux channels.

@marshallwicker
Copy link

Can you provide a little bit more info on how you tested? Hardware (CubeOrange / Pixhawk4 for example) and software (Ardupilot / PX4 and release version). I have some feedback I will leave a review but would like to be able to test as well I'm at it. Thanks for the contribution this seems like a really useful feature.

I tested on the Holybro Pixhawk 5x and Holybro Pixhawk 6c using PX4-Autopilot. I only tested one channel though! I will test further tomorrow.

Also after further review, I have discovered that it wasn't functioning on PX4. RC_OVERRIDE commands are only in ardupilot.

@zdanek
Copy link
Collaborator Author

zdanek commented Oct 14, 2022

Also after further review, I have discovered that it wasn't functioning on PX4. RC_OVERRIDE commands are only in ardupilot.

So it seems PX4 does not implement Mavlink standard message # 70
https://mavlink.io/en/messages/common.html#RC_CHANNELS_OVERRIDE

@marshallwicker I don't know PX4. Can you tell me is there any other mechanism I could use to pass (override) RC channel values?

@dakejahl
Copy link
Contributor

It looks like MAV_CMD_DO_SET_SERVO will accomplish the same thing in Ardupilot. It is also not implemented in PX4. In fact I don't think there is any way in PX4 to allow the GCS to set an actuator output value outside of MAV_CMD_ACTUATOR_TEST

@dakejahl
Copy link
Contributor

@junwoo091400 your input on this PR would be appreciated. I think this feature is useful but we need to find a way for it to work "properly" in both Ardupilot and PX4. Ardupilot does not have any of the ACTUATOR messages/commands in their mavlink fork and PX4 does not currently support setting servo endpoints (by any means) from the GCS using a Joystick.

@zdanek zdanek force-pushed the joystick_chan_mapper branch 2 times, most recently from 76fa87e to e662fe9 Compare December 7, 2022 09:06
Base changes to enable building and running QGC custom builds. QT build script are sufficient to run custom build but CMake scripts totally ignore all custom changes.
There's lot of work to be done in matter of resources which I did not address at all in this commit.
@DonLakeFlyer
Copy link
Contributor

What's the state of this? Still doesn't seem to be ready.

@zdanek
Copy link
Collaborator Author

zdanek commented Jan 3, 2024

I did not push latest changes. I can rework this to Qt6 and in case of Ardupilot it's ready. For PX4 someone who knows it, should propose own solution, probably based on actuators or sth. But for Ardupilot it works nicely on real drones, as we're using it.

@HTRamsey HTRamsey marked this pull request as draft April 12, 2024 12:42
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.

None yet

6 participants