# BlueROV PID vs Statespace

**URL:** <https://discuss.bluerobotics.com/t/bluerov-pid-vs-statespace/8630>\
**Category:** Blue Robotics Software\
**Tags:** ardusub\
**Created:** [November 22, 2020, 5:37pm UTC](https://discuss.bluerobotics.com/t/bluerov-pid-vs-statespace/8630 "2020-11-22T17:37:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdehart](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@rdehart](https://discuss.bluerobotics.com/u/rdehart)\
**Post date:** [November 22, 2020, 5:37pm UTC](https://discuss.bluerobotics.com/t/bluerov-pid-vs-statespace/8630/1 "2020-11-22T17:37:59Z")

</div>

Question and then the explanation:

Are the Attitude Control and Position Control only PID? I know there is an EKF, but the actual control is just PID, right?

Explanation:

My use case for the BlueROV2 is to look at a vertical wall underwater in a turbulent flow. I tried to use OpenCV with Ardupilot but I just could not get it to work. Also, I have read that the Raspberry Pi Camera has a latency of at least 200ms, which may be too slow. I realized I can use the PX4Flow camera to get Optical Flow measurements directly rather than having to stream the frames up to a laptop via ROS, calculate flow and then send the control signals back down. If I can do that Ill toss the ROS stuff. But I am looking at AC\_AttitudeControl currently and all I see is PID. I would like to take each of the states from the EKF and do full state feedback or something similar. I presume this has not been attempted yet.

---

<div class="post-metadata">

**Author:** ![williangalvani](https://avatars.discourse-cdn.com/v4/letter/w/6f9a4e/32.png) [@williangalvani](https://discuss.bluerobotics.com/u/williangalvani)\
**Post date:** [November 23, 2020, 1:17pm UTC](https://discuss.bluerobotics.com/t/bluerov-pid-vs-statespace/8630/2 "2020-11-23T13:17:37Z")

</div>

I don’t think this has been attempted yet. Ardupilot uses nested PID loops to control rate+angle and acc+vel+pos.

You could also try using a dvl pointing forward to lock the wall.

---

<div class="post-metadata">

**Author:** ![rdehart](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@rdehart](https://discuss.bluerobotics.com/u/rdehart)\
**Post date:** [November 23, 2020, 2:01pm UTC](https://discuss.bluerobotics.com/t/bluerov-pid-vs-statespace/8630/3 "2020-11-23T14:01:19Z")

</div>

An interesting idea, thanks. I assume that these PID’s are in the AC\_AttitudeControl\_Sub.cpp, in AC\_AttitudeControl\_Sub::rate\_controller\_run(). But I dont see how they are nested?
