Direct px4 programmatically

Hi, can anyone explain me the correct flow when I want to direct px4 from external source?
What I basically want is to how to take off, (set position)* and land. What I found so far (by digging the sources) is that I should use VEHICLE_CMD_COMPONENT_ARM_DISARM, VEHICLE_CMD_NAV_TAKEOFF, VEHICLE_CMD_DO_REPOSITION, VEHICLE_CMD_NAV_LAND. is it correct?

Yes, and you’ll also need a HEARTBEAT. Take a look at this mavlink example to get started.

Alternatively you can use Dronekit to do the same thing at a slightly higher level.

Thank you! I will try to check dronekit once it will start to open.
The heartbeat is call to orb_publish(ORB_ID(telemetry_status), _telemetry_status_pub, &tstatus) with appropriate status if I understand right.

Seems like heartbeat is not necessary option. These two settings allow to ignore it:
param set COM_RC_IN_MODE 1
param set NAV_RCL_ACT 0