Fly in circles with SET_POSITION_TARGET_LOCAL_NED command

Hi everyone,

I’ve been using Arducopter in 4.1.3 version (2fb939a1cae0a60f478963094431c3b07e6b475a commit) and controlling it via Dronekit. I tried to send the next command via the next function in guided mode, but I don’t get drone to fly to the right. The drone always change its yaw position to the direction right and if I try to send the commands continuously, the drone fly in circles. Is there a way to fix this problem?

def right(self, velocity : int) -> bool:
    msg = self.vehicle.message_factory.set_position_target_local_ned_encode(
        0,
        0, 0,
        mavutil.mavlink.MAV_FRAME_BODY_OFFSET_NED,
        0b0000111111000111,
        0, 0, 0,
        0, velocity, 0,
        0, 0, 0,
        0, 0)

    return self.send_mavlink_message(msg)

Thank you in advance

2 Likes

@stokekld,

Thanks for the report.

The issue is a change in behaviour vs 4.0 in that the vehicle will automatically yaw in the direction it is told to fly. You should be able to get around this by setting the yaw_rate field to zero (and set the appropriate bit in the bitmask field)

As a side note, we’ve improved our MAVLink Interface wiki pages but this particular issue is not mentioned so I will add it.

FYI @Leonardthall @hendjosh

3 Likes

Thank you so much, it all works fine.