How to auto-start work queue task applications?

I want to write a module in PX4 that runs right from the start of the Pixhawk. I found this page of the PX4 documentation, which describes work tasks and work queue tasks. For work tasks, it states that their call (taskname start) must be added to the system’s startup script. For work queue tasks, it says:

A work queue task application is just the same as an ordinary (task) application, except that it needs to specify that it is a work queue task, and schedule itself to run during initialisation.

To me “schedule itself to run during initialisation” sounds exactly like what I want to achieve. However, the page does not mention how this is accomplished. Even the example module from the page does not run from the start of the Pixhawk. I have to manually execute work_item_example start in the MAVLink console of QGroundcontrol for it to run.

So, my question is: How can one create a module as a work queue task that runs from the start of the Pixhawk?

1 Like

Hello Friedrich

The same issue here, actually I am new with the PX4 firmware development field.
When I build the PX4 firmware the work_item module is not being built, knowing that I added it to the default.px4board file (CONFIG_EXAMPLES_work_item=y).
I wanna ask you, do you find the work_item in the tasks when you use the “work_queue status” command?? because I do not

Thanks in advance

You need to add it in the startup script.
So ROMFS/px4fmu_common/init.d/rcS.

I added it before the line that says “# End of autostart”.
So, you could add: work_item_example start.
Then rebuild the firmware and flash the board.

Try the work_queue status, and it should be running on wq:test1, if you didn’t change that in the code.

1 Like