Using thrust in setpoint_raw/attitude topic causes drone to crash

Hi,
I’m new to Px4, was using Ardupilot till now. So I am using setpoint_raw/attitude topic to publish thrusts to move my drone from one coordinate to another. It was working on Ardupilot SITL, but as I faced some issues with Ardupilot and Gazebo, I have shifter to Px4.
So the problem now is if I give any value for the thrust, the drone just oscillates and crashes. A thrust of 0.5 worked previously, but not here. So here are all my questions.

  1. Why does the drone crash for all values of thrust.
  2. Why am I able to set OFFBOARD mode only after I publish to the topic (else it gives a Time Out error)
  3. Is setpoint_raw/attitude supported and working for px4.

Thanks :slight_smile:

It is supported, I am using it here: mavros_controllers

Hey, so can you tell me how you determine the value of thrust. And why is that the OFFBOARD controller can be set only after publishing a message? Thanks

@Withered_Shadow

  1. It is a safety feature. If you don’t have any setpoints and switch the drone into to offboard mode, it is hard to determine what the drone should do. This can happen when the companion computer dies or something is wrong with the communication. Therefore the drone exits offboard mode and comes back to normal mode where it can at least not crash into the ground.

  2. The thrust values are the normalized thrust values. 1 is the maximum thrust the drone can make.

So what is the mapping between real world thrust and the normalized ones? What would be the thrust for just hovering? and these thrusts are in the body fixed frame right?

@Withered_Shadow That only you would know. The flight controller has no information of the hardware you are using.

Sorry for all the questions, but how do I calculate it?

As I said, 1 is the maximum thrust.

Maximum thrust can be measured. If you want to guess a good guess would with the weight of your vehicle and the hover throttle position.

Look at what I am doing in the repo that I sent you. It is doing exactly that

Hey, so Im working only on the simulation in Gazebo right now. Im sorry if I understood you wrong, or confused you. Hence I cannot measure the maximum thrust from hardware as we have not started experiments yet. Is there any way to calculate it for example from the values in the sdf file for the drone. Thanks and sorry for the confusion caused

      <timeConstantUp>0.0125</timeConstantUp>
      <timeConstantDown>0.025</timeConstantDown>
      <maxRotVelocity>1500</maxRotVelocity>
      <motorConstant>8.54858e-06</motorConstant>
      <momentConstant>0.06</momentConstant>
      <commandSubTopic>/gazebo/command/motor_speed</commandSubTopic>
      <motorNumber>0</motorNumber>
      <rotorDragCoefficient>0.000806428</rotorDragCoefficient>
      <rollingMomentCoefficient>1e-06</rollingMomentCoefficient>