Replace the rc control

I want pc control the pixhawk
I have a idea
I use tcp/ip connect the Nodemcu and create the pwm signal to control the drone
Is it work?
How to change the flight mode (like position altitude)

Take a look at the Mavlink spec.
In particular the MANUAL_CONTROL ( message.