Controlling USV roll with a python script


I’m currently developping an USV (unmanned surface vehicle) based on Navio2 + RPi3.
The body of the USV is a cylinder. I already tested buoyancy with all the battery packs etc in it, but there is a lot of roll (maybe because of the torque induced by the propulsion) and most of the time the USV turned into a torpedo, rotating on its X axis (roll).
I partially fixed this by adding fixed stern fins (see illustration below), but the submarine isn’t really roll stabilized and keeps on abruptly bouncing left to right …

I Just added a servo to each of the two fins in order to control the roll. But here is my question :

Is there a way to run a python script that controls the servos according to the gyroscope informations ?

I would like to know if I should use ardurover or an other firmware, where to put a script, how to run it on startup, etc.

I also at first tried to get the informations returned by the gyroscope by cloning the following repo and running the script but it seems that it can’t run alongside ardupilot. Does anyone know the reason why ?

I’m brand new to ardupilot and its components but I have good scripting experience.

Thanks a lot in advance for your help !

Hi Max,

Nice to see you back on our forum!

Oh, we only have the example of how to control the servos by setting the frequency and duty cycle. But this script is a simple one. For your task, you would need to introduce lots of changes and new variables there to use for servos’ control.

ArduPilot might be using the same resources as our scripts. It can lead to conflicts and distorted values. That’s why we don’t recommend running any of the Navio2 examples while ArduPilot is enabled.

1 Like

Thanks for your answer !

Is there a way to get the roll informations while ardupilot is running ?

My goal is to have an automatic roll stabilization running on the drone while I control the direction from my GCS (ex. Mission Planner).

As anyone done this before ? :slight_smile:

Hi Max,

It looks like nobody has done this before with the USV, at least no one from our forum users :sweat_smile:. Probably, you need something similar to the Stabilize mode for this. It can self-level the roll and pitch axis.

1 Like

Thanks ! I will take a look to it !
Looks much more complicated than expected…

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.