MAV_CMD_CONDITION_YAW does not work

I am able to establish a connection between my companion computer and a copter. It responds to ARM command but does not respond to MAV_CMD_CONDITION_YAW command.

    # Turn relatively to 0
    def turn(self, angle):
        # Define the heading change in degrees (-180 to 180, negative for left)
        left_turn_angle = angle  # 90 degrees left turn

        # Send MAV_CMD_CONDITION_YAW command to set the desired heading
        self.connection.mav.command_long_send(
            self.connection.target_system,  # Target system ID
            self.connection.target_component,  # Target component ID
            mavutil.mavlink.MAV_CMD_CONDITION_YAW,  # Command ID
            0,  # Confirmation
            left_turn_angle,  # Desired heading in degrees
            15,  # Hold time (0 to continue indefinitely)
            1,  # Relative offset (1 for relative angle)
            0,  # Empty (ignored)
            0,  # Empty (ignored)
            0,  # Empty (ignored)
            0,  # Empty (ignored)
        )
        msg = self.connection.recv_match(type="COMMAND_ACK", blocking=True)
        print(msg)

msg returns {result: 0} which means it is ok but drone does not turn. Is it something with Guided mode? Because I fly in Stabilize or AltHold mode. It is not a mission, I manualy control a drone but it just dont turn

It requires guided mode.
Stabalize and alt mode can not do this per definition

1 Like

How I can activate Guided mode shen I start drone in Stabilize mode?

If drone has gps but there is no gps signal will it run this command?

No it will not.You need signal.

1 Like

Thank you for your answers. If I attach Optical flow sensor will it allow me to switch to GUIDED mode ?

I added optical flow sensor. No I am able to arm a copter in Guided mode but drone still does not turn when I call this function. I am receiving result:0 means success but dont have any effect. It works in simulator but does not work with real drone

It works on our real drone, so you need to provide more details.

Which data exactly do you need? I can give you an access to my repo and provide you with my preset. Will it be enough? Maybe you need some logs? I am a beginner, this topic is very new for me