PWM output not constant

I want to modify the Servo.cpp in the Navio2/C++/Example/Servo folder to be able initiate and set the speed of ESCs from standard input. When I set the PWM duty cycle with the set_duty_cycle command, an oscilloscope shows that the raspberry pi emits the PWM for a second and stops. When compared to a receiver I purchased from Flysky, the PWM signal is constantly emitting.

Yes, you’re right. This is extremely non-obvious behavior. This has been done to ensure that once no commands are getting sent to a Linux kernel driver that controls PWM for more than 20ms, the outputs are unarmed.

In order to update duty cycle you need to call update method at least @50Hz.

Thank you for the response. A little back story.
I setup the Navio2/Raspberry Pi before and I was able to both get the motors turn at a constant and variable speed. I reinstall the software to fix a separate issue. Then I did the tutorial and modify the C++/Servo .cpp file. Now I getting the issue with the PWM shutting off. I feel that the set_duty_cycle should set the PWM and it should stay at that frequency until it is changed. The PWM should be independent of whatever else is going on in the program. Wouldn’t constantly updating the PWM be very heavy on the processor?

It is not about being heavy on the processor, it is a safety feature. We are considering that if a program is not able to command PWM at 50Hz it is hung and motors should be disabled.