# Navigation control and attitude control

**URL:** <https://discuss.bluerobotics.com/t/navigation-control-and-attitude-control/13242>\
**Category:** Blue Robotics Vehicles\
**Tags:** ardusub\
**Created:** [November 21, 2022, 4:22am UTC](https://discuss.bluerobotics.com/t/navigation-control-and-attitude-control/13242 "2022-11-21T04:22:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![suitangxiaoyi](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@suitangxiaoyi](https://discuss.bluerobotics.com/u/suitangxiaoyi)\
**Post date:** [November 21, 2022, 4:22am UTC](https://discuss.bluerobotics.com/t/navigation-control-and-attitude-control/13242/1 "2022-11-21T04:22:07Z")

</div>

Hi，guys  
I‘m learning the code of Arddupilot, and there is a problem which I can’t understand. The L1 controller is the waypoint navigation method, and the output of it is lateral acceration. The attitide controller is used for sttabilizing sailing attitude. The question is what is the relationship between the two controller, whether they work independently or are connected as some function?

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [November 24, 2022, 5:49am UTC](https://discuss.bluerobotics.com/t/navigation-control-and-attitude-control/13242/2 "2022-11-24T05:49:05Z")

</div>

Hi @suitangxiaoyi,

I spoke with @williangalvani (our lead ArduSub developer) about this, and he mentioned he’ll need to take a closer look a bit later to give a more detailed response.

As a starting point, I’d refer you to the [`control_auto.cpp`](https://github.com/ArduPilot/ardupilot/blob/master/ArduSub/control_auto.cpp) and [`control_guided.cpp`](https://github.com/ArduPilot/ardupilot/blob/master/ArduSub/control_guided.cpp) files.

Note that because ArduSub is based on ArduCopter there are some rotationally-focused variable names in the attitude control code (`libraries/AC_AttitudeControl`) that ArduSub actually [uses for direct horizontal motion control](https://github.com/ArduPilot/ardupilot/blob/d5ec5f1dfcfd4c9ab4267e12eb02e0d2d2c70376/ArduSub/motors.cpp#L134-L148).

---

<div class="post-metadata">

**Author:** ![suitangxiaoyi](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@suitangxiaoyi](https://discuss.bluerobotics.com/u/suitangxiaoyi)\
**Post date:** [November 24, 2022, 7:27am UTC](https://discuss.bluerobotics.com/t/navigation-control-and-attitude-control/13242/3 "2022-11-24T07:27:58Z")

</div>

Thanks for your help
