Model based and sensor based programming of compliant motion tasks