Switching between setpoint attitude and setpoint position

I am using vicon to get the pose feedback for my drone. I am able to switch the pixhawk into offboard mode. Now what I am trying to accomplish is

  1. Give setpoints and takeoff and hover.
  2. Initiate in the position controller I have written to give desired roll pitch yaw angles which would be converted to quaternions and sent to pixhawk using setpoint attitude commands.
  3. I will require to supply some desired normalized thrust as well while doing so in the range between 0-1.

Now I am wondering how I can make this switch without crashing the drone?

Thank you.

@arg1885 I am not sure what the problem is. if your position controller is sufficient to control the vehicle, it won’t make it crash

I am more concerned about setting the nominal thrust value when I switch the setpoint from pose to attitude when initiating my position controller.

@arg1885 If you are worried, you can test it in SITL before you test it in the real vehicle.

For me, this has not been a issue as the thrust values mapping with the normalized thrust values can be calculated quite simply from your hardware. This is usually enough to fly the drone in a predictable manner.

If you need an example you can see what I am doing here

What is your Hardware configuration…???