Only Z position + Extra motors control

Hi everybody!

I’m using Pixhawk into a customized quadrotor controlled in offboard mode through mavros. What I’m trying to do is controlling the quadrotor taking into account only the Z position (the altitude), pitch and yaw. I’m publishing Z position into PositionTarget applying the following mask:

pose_target.type_mask =
mavros_msgs::PositionTarget::IGNORE_AFX |
mavros_msgs::PositionTarget::IGNORE_AFY |
mavros_msgs::PositionTarget::IGNORE_PX |
mavros_msgs::PositionTarget::IGNORE_PY |
mavros_msgs::PositionTarget::IGNORE_YAW |

When I execute it doesn’t work properly. My quadrotor still tries to maintain the initial position in x and y axis. I’m trying it first it in SITL in Gazebo and publishing only the z position and applying a gravity force in x or y axis the quad maintain the position (and it shouldn’t). Does anybody know what I’m doing wrong?

There is also another point. I want to control two extra motors, which are connected in channel 6 and 7 and I can control them publishing in ActuatorControl. The problem appears when I want to control them while it is not landed. For instance, when it is hovering and I publish in ActuatorControl, the extra motors are activated but all the other ones stopped, then the quad falls.

Probably the values of ActuatorControl overwrite those of the PositionTarget, Is there any way to control those two channels (5 and 6) separately without disturbing the other channel values?

The idea is activating the extra motors while the quad is controlling only Z position. I would really appreciate any help!

Thanks in advance,

Daniel Rios