Yes, this can be done via Mavlink. See Dronecode.org for more information.