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. https://mavlink.io/
In particular the MANUAL_CONTROL (https://mavlink.io/en/messages/common.html#MANUAL_CONTROL) message.