Vehicle rotating to left or right while activating channel 5 [FORWARD]

Hello dear forumers,
We are working on an AUV system and currently we are facing with a problem. I’ll get into the point quickly.

I have two videos that showing what is the problem and i’ll leave the running codes in the shown videos below the links.

The problem in summary is: Whether we drive the vehicle on STABILIZE or DEPTH_HOLD modes, when we send PWM to the channel 5 [FORWARD] the vehicle randomly rotating left and right.

Video1:

The Code Running on Video1:

import mylib

master = mylib.essentials.connect()

boot_time = mylib.tools.set_boot_time()

mylib.essentials.arm_vehicle(master)

mylib.drive.set_vehicle_mode(master, 2) #Depth hold mode.

mylib.drive.set_target_depth(master, -0.5, boot_time) #Supposed to go 0.5 meters depth.

current_time = mylib.tools.set_timer() 
while True:
    timer = mylib.tools.set_timer() - current_time
    if timer < 5:
        mylib.drive.override_motor_channels(master) #Sends 1500pwm to all channels to keep motors alive while setting the depth.
    if timer >= 5 and timer < 10:
        mylib.drive.override_motor_channels(master, ch5= 1600) #For the next 5 secs, sends 1600pwm to channel 5, which is forward.
    if timer >= 10:
        break

mylib.essentials.disarm_vehicle(master)

Video2:

The Code Running on Video2:

import mylib

master = mylib.essentials.connect()

mylib.essentials.arm_vehicle(master)

mylib.drive.set_vehicle_mode(master, 1) #Stabilize mode.

current_time = mylib.tools.set_timer() 
while True:
    timer = mylib.tools.set_timer() - current_time
    if timer < 5:
        mylib.drive.override_motor_channels(master, ch3= 1625) #Sends 1625pwm to Channel3 (THROTTLE).
    if timer >= 5 and timer < 10:
        mylib.drive.override_motor_channels(master, ch3= 1625, ch5= 1575) #For the next 5 secs, sends 1625pmw to channel 3 and 1575pwm to channel 5.
    if timer >= 10:
        break

mylib.essentials.disarm_vehicle(master)

The function used for overriding channels:

def override_motor_channels(master, ch1= 1500, ch2= 1500, ch3= 1500, ch4= 1500, ch5= 1500, ch6= 1500, ch7= 1500, ch8= 1500): 
        master.mav.rc_channels_override_send(
            master.target_system,
            master.target_component,
            ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8)

Thanks for your time reading this, any help will appreciated. Have a nice day :slight_smile:

Hi @toosat,

Which ArduSub version are you using? We’ve very recently released ArduSub 4.1.0 as the latest stable version (I’ll be making a post about it in the next day or two) - does this still occur when using that version?

Thanks for the response @EliotBR ,
We are currently using 4.0.3 version of ArduSub. I’ll make an update here when i have the chance of trying it with 4.1.0.

Hello @EliotBR ,
We have just updated ArduSub to the version 4.1.0 and unfortunately yes, the problem still occuring on this version too. I have two videos that i just recorded, leaving them below. Also i’ve noticed that it is not only happening when we activate the channel5, it happens at every channel changing situation.

Video 1:

Video 2:

  1. When no thrust is being supplied, does the vehicle sit flat in the water, or does it sit at an angle?
  2. Does re-calibrating the sensors help?
  3. Are you able to provide a dataflash log?

That should help us determine whether there’s an issue with ArduSub’s stabilisation functionality, or if perhaps your vehicle has an unbalanced mass/buoyancy distribution that the stabilisation is trying to counteract.

  1. Our vehicle’s bow side is heavier. Also because of our capsule made by aluminum, the vehicle sinks when we release it into the water. Therefore the vehicle falls down towards it’s front once we release it.
  2. Actually, we solved the gliding problem of our vehicle via kind of tricking the Pixhawk. We re-adjsuted the Pixhawk’s nose pitch to a little bit upper than it supposed to be. By doing this, i guess we somehow managed to provide a balance between center of mass and Pixhawk.
  3. I uploaded the LOGS folder to Google Drive. Here is the link: LOGS - Google Drive

In my opinion the cause of this problem is about center of mass/bouyancy of vehicle. But currently we don’t have much options to make fixes on vehicle body so we are trying to find solutions on the software side.

Hello dear forumers,
Today i had the chance of getting some underwater footage that the issue can be observed more clearly. I’ll leave the video link below.

Video:

The code running on the Video:

import mylib

master = mylib.essentials.connect()

mylib.essentials.arm_vehicle(master)

mylib.drive.set_vehicle_mode(master, 1) #Stabilize mode.

current_time = mylib.tools.set_timer() 
while True:
    timer = mylib.tools.set_timer() - current_time
    if timer < 5:
        mylib.drive.override_motor_channels(master, ch3= 1630) #Sending 1630pwm to Channel3 (THROTTLE).
    if timer >= 5 and timer < 10:
        mylib.drive.override_motor_channels(master, ch3= 1630, ch5= 1575) #Sending 1630pmw to channel 3 and 1575pwm to channel 5.
    if timer >= 10 and timer < 15:
        mylib.drive.override_motor_channels(master, ch3= 1630) #Sending 1630pwm to Channel3 (THROTTLE).
    if timer >= 15 and timer < 20:
        mylib.drive.override_motor_channels(master, ch3= 1630) #Sending 1630pwm to Channel3 (THROTTLE).
    if timer >= 20:
        break
        
mylib.essentials.disarm_vehicle(master)