Crash when mode Change on copter-4.0.3

Hi,
I’m using pixhawk 2.4.3 and copter-4.0.3 version installed on.
I tried to control the copper with attitude control using dronekit API.(set_attitude_target)
I used this function for this;

  def send_attitude_target(self, roll_angle=0.0, pitch_angle=0.0, yaw_angle=None, yaw_rate=0.0, 
                                         use_yaw_rate=False,thrust=0.5):
        if yaw_angle is None:
            # this value may be unused by the vehicle, depending on use_yaw_rate
            yaw_angle = self.vehicle.attitude.yaw
        # Thrust >  0.5: Ascend
        # Thrust == 0.5: Hold the altitude
        # Thrust <  0.5: Descend
        msg = self.vehicle.message_factory.set_attitude_target_encode(
            0,  # time_boot_ms
            1,  # Target system
            1,  # Target component
            0b00000000 if use_yaw_rate else 0b00000100,
            self.to_quaternion(roll_angle, pitch_angle, yaw_angle),  # Quaternion
            0,  # Body roll rate in radian
            0,  # Body pitch rate in radian
            math.radians(yaw_rate),  # Body yaw rate in radian/second
            thrust  # Thrust
        )
        self.vehicle.send_mavlink(msg)

Copter is in guided mode while atitude control command is running.When I do any intervention from remote controller(RC), the code changes the copter to rtl mode.I assigned stabilize and land mode to the stick on the remote controller.
2020-03-25 14-14-31.bin (969.7 KB)
First Flight:

  • Atitude control command worked. The copter was switched land mode from remote control(RC)to bring it back.
  • It can be seen from the logs. It changes from land mode to rtl mode.
  • As a result, the copter came back to where it took off and was disarmed


Second Flight:

  • Atitude control command worked. The copter was switched stabilize mode from remote control(RC)to bring it back.
  • It can be seen from the logs. It changes from stabilze mode to rtl mode.Meanwhile, the throttle stick on the remote controller was at its lowest position.
  • Although it is seen that rtl mode in the logs, the copter has fallen to the ground and is broken

What could be the reason for this?Can mod change cause this?

Thanks.

2 Likes

I had a similar problem but when in circle mode and switched to RTL it crashed

Sir,
Did you find out why or Do you have an idea ?

1 Like

No I did not funny thing is it only happened in circle if I flew long distance away in spabilized or Alt Hold and switched into RTL no problem

Sir,
If you have examined the logs, there is about 200ms delay when changing from stabilized mode to rtl mode.By the way, the motors spin at their lowest speed and even stop.Did you have this much difference when switching from stabilized mode to rtl mode? Is the time between mod changes normal?

In addition, after switching to rtl mode, motors were given pwm for a short time but then dropped to min value.