AttitudeTarget command

I want to use AttitudeTarget command to control my drone autonomously. I am using a PID controller for roll , pitch, yaw to achieve my desired values(my desired roll, pitch, yaw is 0,0,0). From the PID outputs i can calculate the respective torques(roll torque, pitch torque, yaw torque) . But i don’t know how to map these torques to roll, pitch, yaw which i have to give as input in AttitudeTarget command.
I will be very happy if anybody help in this.
Thank you in advance.

You must translate these roll, pitch, and yaw angles into a NED quaternion and put that in the q field of SET_ATTTITUDE_TARGET.

I’m assuming this is for a copter?

There is an example here to roll at 10 degrees: Copter Commands in Guided Mode — Dev documentation

Thank you for the reply! I apologize for the confusion in my question. I do understand how to convert roll, pitch, and yaw angles into a NED quaternion for the q field in SET_ATTITUDE_TARGET. What I’m actually struggling with is how to map the torques I calculate from my PID controller (roll torque, pitch torque, yaw torque) to the roll, pitch, and yaw inputs for SET_ATTITUDE_TARGET. For instance, if my PID outputs a roll torque of 0.1 Nm, how should I convert that to a roll or roll rate, Also, I’m operating without GPS, so I’d like to ensure this approach works in that setup. Any advice or examples would be really helpful. Thanks again for your support!

ArduPilot does not have a torque controller.
You must convert your torque into a desired acceleration using the moment of inertia of your vehicle because ArduPilot does not know mass/inertia properties of the vehicle.

It does’t look there is a MAVLink interface to ArduPilot to supply desired angular accelerations though. What was your plan?

Thanks for the response and for highlighting that ArduPilot doesn’t know the vehicle’s mass/inertia properties and lacks a MAVLink interface for desired angular accelerations. To be honest, I don’t have a specific plan yet, which is why I’m seeking guidance. I’m operating without GPS, and I’m using a PID controller to calculate roll, pitch, and yaw torques to achieve my desired attitude (roll, pitch, yaw of 0,0,0). I was hoping to map these torques directly to the roll, pitch, and yaw inputs in SET_ATTITUDE_TARGET, but I understand now that this isn’t straightforward. Is there another way to use my calculated torques to control the drone’s attitude in ArduPilot, especially without GPS? Any alternative methods or examples would be greatly appreciated. Thanks again for your help!

I understand that mapping my PID-calculated torques directly to SET_ATTITUDE_TARGET isn’t straightforward in ArduPilot.Since I’m operating without GPS and don’t have a clear plan yet, I’d like to take a step back and ask: what are the common or most widely used commands and methods for autonomous drone control in ArduPilot when GPS is not available?I’m open to exploring other approaches that don’t rely on GPS. Any insights, examples, or recommended commands would be greatly appreciated. Thanks!