# Setpoint\_attitude/attitude quaternion transformation

**URL:** <https://discuss.px4.io/t/setpoint-attitude-attitude-quaternion-transformation/15081>\
**Category:** PX4 Autopilot\
**Created:** [February 8, 2020, 12:35am UTC](https://discuss.px4.io/t/setpoint-attitude-attitude-quaternion-transformation/15081 "2020-02-08T00:35:10Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Haijie\_Zhang](https://discuss.px4.io/user_avatar/discuss.px4.io/haijie_zhang/32/4448_2.png) [@Haijie\_Zhang](https://discuss.px4.io/u/Haijie_Zhang)\
**Post date:** [February 9, 2020, 10:20pm UTC](https://discuss.px4.io/t/setpoint-attitude-attitude-quaternion-transformation/15081/3 "2020-02-09T22:20:13Z")

</div>

Hi Jaeyoung,  
I have several more questions.

1. Is there a reason you use angular rates instead of desired roll pitch yaw to do this?

2. I saw there is a function `quaternion acc2quaternion(acceleration, yaw)`. Does that mean after I get aceleration from my own PID controller, I directly use directly use this function to get the desired quaternion angle? Then I can pub this quaternion angle to `setpoin_attitude/attitude `?

3. If question 2 is correct, what should I use for `cmd_att.pose.position.x y z` as shown in your post? [https://404warehouse.net/2015/12/20/autopilot-offboard-control-using-mavros-package-on-ros/](https://404warehouse.net/2015/12/20/autopilot-offboard-control-using-mavros-package-on-ros/)  
My understanding is that px4 wouldn’t use these three position values since it is the attitude control, only concentrate on the attitude values. Is it correct?

4. From your answer this post, [https://discuss.px4.io/t/trajectory-following-via-acceleration-setpoints-which-controller-to-use/7106](https://discuss.px4.io/t/trajectory-following-via-acceleration-setpoints-which-controller-to-use/7106), it seems I can directly use three desired accelerations to control the quad with `setpoint_accel/accel`. Is it correct? (Actually my desired attitude and thrust is calculated from desired accelerations based on the flatness equation). If yes, it would simplify my work.

Thanks for your time.

---

_[View the full topic](https://discuss.px4.io/t/setpoint-attitude-attitude-quaternion-transformation/15081)._
