Need help to send position (x,y) and thrust commands

I have developed a controller which gives thrust values. So I am sending thrust commands using set_attitude_target_encode(). However, this functions sends default (zero) values of roll, pitch and yaw due to which the UAV is drifting itself. To avoid this, I am planning to engage position (x,y) hold. For this, I need to know how to set target_x and target_y (not target_z) and then, get desired_roll and desired_pitch from the internal Attitude Controller. Finally, I will pass desired_roll, desired_pitch, desired_yaw=0 and thrust (given by my controller) to ArduPilot using set_attitude_target_encode().

First you need to update to ArduCopter 4.3.4-rc1