Linux PWM support in vtol_att_control

Hi, I am fairly new to PX4 and have been working on building a tilt rotor VTOL using a RPi and Navio2. I got my Docker dev environment up and am able to cross build the binary for the Pi.

I have been able to set it up as a multirotor however have not been successful in configuring it as a tilt rotor VTOL. I have a suspicion that vtol_att_control doesnā€™t support Linux PWM device from linux_pwm_out module and seems to default to only /dev/pwm_output0 from the pwm module.

Iā€™ve searched the source repo quite a bit, existing sample airframe configs and discussions and havenā€™t seen anyone encountered this.

Can someone who know vtol_att_control well shed some insight? Thanks!

Eddy

Hi @eddyanm, I have no experience with PX4 on Linux, but it could be that thereā€™s a problem with the PWM part of it. So you need both /dev/pwm_output0 and /dev/pwm_output1 for your vehicle? If possible I would try fitting all actuators on /dev/pwm_output0, would that be possible?

Hi @sfuhrer, with PX4 on Linux, the PWM device is named /sys/class/pwm/pwmchip0.

I donā€™t have the history but it appears that instead of pwm system command which assumes /dev/pwm_output0 as the PWM device , linux_pwn_out driver was written to take its place to work with Linux device /sys/class/pwm/pwmchip0. But on the other hand, vtol_att_control is hard coded to use pwm and its device (as far as I can tell). I am hoping someone can give me some background on it so I can perhaps improve vtol_att_control to support Linux based hardware.

Thanks.
Eddy

@eddyanm yeah currently the VTOL controller directly sets PWM limits to cut off the hover motors in fixed-wing. I guess you at least have to change that here, possible also other stuff. Hope you make it work!

I opened an issue for this: https://github.com/PX4/PX4-Autopilot/issues/16601