# BlueRov2 LQR stabilization simulation in Matlab and ROS

**URL:** <https://discuss.bluerobotics.com/t/bluerov2-lqr-stabilization-simulation-in-matlab-and-ros/11612>\
**Category:** BlueROV2\
**Tags:** simulate\
**Created:** [February 23, 2022, 9:32pm UTC](https://discuss.bluerobotics.com/t/bluerov2-lqr-stabilization-simulation-in-matlab-and-ros/11612 "2022-02-23T21:32:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidd](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@davidd](https://discuss.bluerobotics.com/u/davidd)\
**Post date:** [February 23, 2022, 9:32pm UTC](https://discuss.bluerobotics.com/t/bluerov2-lqr-stabilization-simulation-in-matlab-and-ros/11612/1 "2022-02-23T21:32:10Z")

</div>

Hello,  
I’ve designed a LQR controller in Matlab for BlueRov2 stabilization. I’ve searched for possibilities to link Matlab directly to the rov but I can t seem to find anything useful, so I will try using ROS. I want to simulate the controller using bluerov\_ros\_playground and I’m not sure where to start and what is the right way of doing it. I appreciate any advice you can give me.  
Thanks!

---

<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:** [February 24, 2022, 4:08am UTC](https://discuss.bluerobotics.com/t/bluerov2-lqr-stabilization-simulation-in-matlab-and-ros/11612/2 "2022-02-24T04:08:25Z")

</div>

Hi @davidd, welcome to the forum 🙂

> [@davidd](#):
>
> I’ve designed a LQR controller in Matlab for BlueRov2 stabilization.

Cool! Interested to know how this performs 😃

> [@davidd](#):
>
> I’ve searched for possibilities to link Matlab directly to the rov but I can t seem to find anything useful

The BlueROV2 runs our ArduSub firmware, which communicates using the [MAVLink protocol](https://mavlink.io/en/). From a quick search of “mavlink matlab”, [this](https://au.mathworks.com/help/uav/mavlink-support.html) could be useful.

> [@davidd](#):
>
> I want to simulate the controller using bluerov\_ros\_playground and I’m not sure where to start and what is the right way of doing it.

For bluerov\_ros\_playground, I’d recommend you start by reading through [this thread](https://discuss.bluerobotics.com/t/controlling-bluerov2-from-topside-computer-via-ros/10215), and the relevant resources it links to.
