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

How to change PWM output signal? #533

Closed
maitham opened this issue Sep 5, 2018 · 4 comments
Closed

How to change PWM output signal? #533

maitham opened this issue Sep 5, 2018 · 4 comments

Comments

@maitham
Copy link

maitham commented Sep 5, 2018

I'm trying to change the PWM output using dronecode sdk. I don't need to run a mission or anything, I want to do a static test where I can simply change values. I seem to be running out of options in terms of simply changing pwm outputs within a script in a reliable manner (NSH pwm test works but only for main out). Is there anyway of currently doing this?

@hamishwillee
Copy link
Collaborator

I don't think this is possible with the SDK because there is AFAIK no API to support it AND this won't necessarily be supported by default in PX4.

Without having tried this (i.e. maybe not correct) .... to make it work in PX4 you'd have to look at adding a mixer file to map control inputs to outputs - http://dev.px4.io/en/concept/mixing.html
To drive it you would need to send the appropriate MAVLink message (or have an onboard app that does the work for you).

@hamishwillee
Copy link
Collaborator

PS The people who might help with this are possibly at Interdrone.

@bkueng Can you comment about PX4 support? As I understand it the mixer is what defines what comes out of the MAIN/AUX outputs - for certain inputs (control group UORB topics?). Does the mapping between MAVLink and those UORB topics exist - ie if you create a mixer and send the appropriate MAVLink message will this work?

@julianoes
Copy link
Collaborator

@MaithaM1 this will need some work for the SDK.

In the meantime, if pwm test works, you should try to make pwm test work for the aux output as well. Note that there is a -d argument which should enable you to choose the device, e.g. /dev/pwm_output0 or /dev/pwm_output1.

@julianoes
Copy link
Collaborator

julianoes commented May 27, 2024

There is now the set_actuator call:

/**
* @brief Send command to set the value of an actuator.
*
* Note that the index of the actuator starts at 1 and that the value goes from -1 to 1.
*
* This function is blocking. See 'set_actuator_async' for the non-blocking counterpart.
*
* @return Result of request.
*/
Result set_actuator(int32_t index, float value) const;

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

No branches or pull requests

3 participants