I am trying to control the BlueROV2 using position targeting rather than RC override or manual inputs. I used SET_POSITION_TARGET_INT to implement depth hold at a target depth like the example on the Ardusub website Pymavlink · GitBook and it worked perfectly.
master.mav.set_position_target_global_int_send(
int(1e3 * (time.time() - boot_time)), # ms since boot
master.target_system, master.target_component,
coordinate_frame=mavutil.mavlink.MAV_FRAME_GLOBAL_INT,
type_mask=( # ignore everything except x, y, & z positions
# DON'T mavutil.mavlink.POSITION_TARGET_TYPEMASK_X_IGNORE |
# DON'T mavutil.mavlink.POSITION_TARGET_TYPEMASK_Y_IGNORE |
# DON'T mavutil.mavlink.POSITION_TARGET_TYPEMASK_Z_IGNORE |
mavutil.mavlink.POSITION_TARGET_TYPEMASK_VX_IGNORE |
mavutil.mavlink.POSITION_TARGET_TYPEMASK_VY_IGNORE |
mavutil.mavlink.POSITION_TARGET_TYPEMASK_VZ_IGNORE |
mavutil.mavlink.POSITION_TARGET_TYPEMASK_AX_IGNORE |
mavutil.mavlink.POSITION_TARGET_TYPEMASK_AY_IGNORE |
mavutil.mavlink.POSITION_TARGET_TYPEMASK_AZ_IGNORE |
# DON'T mavutil.mavlink.POSITION_TARGET_TYPEMASK_FORCE_SET |
mavutil.mavlink.POSITION_TARGET_TYPEMASK_YAW_IGNORE |
mavutil.mavlink.POSITION_TARGET_TYPEMASK_YAW_RATE_IGNORE
), lat_int=0, lon_int=0, alt=depth, # (x, y WGS84 frame pos - not used), z [m]
vx=0, vy=0, vz=0, # velocities in NED frame [m/s] (not used)
afx=0, afy=0, afz=0, yaw=0, yaw_rate=0
# accelerations in NED frame [N], yaw, yaw_rate
# (all not supported yet, ignored in GCS Mavlink)
)
I’m trying to use the ignored parts of this same message to control other parameters of the position besides altitude. It looks like you need GPS to use the lat and long parameters, but according to the MAVLink site and the comments in the code above, velocity and acceleration use a North, East, Down (NED) reference frame, and shouldn’t require GPS input.
I tried to use the same message above but with non-zero vx and vy to make the ROV move laterally. I tried it without changing any of the ignore lines. I tried commenting out the lines that ignore Vx, Vy, and Vz. I tried doing that plus ignoring the x, y, and z positions. None of these attempts made the BlueROV2 move laterally at all.
I even tried using the very similar message, SET_POSITION_TARGET_LOCAL_NED, so I could try all of the above but with a non-zero x and y parameter in the NED reference frame. That didn’t work either.
Any idea what’s wrong with what i’m doing?