"mavlink msg set position target global int" is not working in HITL mode

Anyone know how to use position_target together with simulation? When I try and send mavlink_msg_set_position_target_global_int_t it does nothing. So looking at the PX4 code it seems I want to enable the follow_target object in the Navigator which happens when nav_state is changed to NAVIGATION_STATE_AUTO_FOLLOW_TARGET, so I see Commander does that when I send MAV_MODE_FLAG_CUSTOM_MODE_ENABLED, PX4_CUSTOM_MAIN_MODE_AUTO, PX4_CUSTOM_SUB_MODE_AUTO_FOLLOW_TARGET but when I do this jMavSim (in HITL mode) drops out of the sky and crashes, saying that the set mode command caused a disarm. Any thoughts?

I’m looking for fine grained velocity control (vx,vy,vz) and mavlink_msg_set_position_target_global_int_t seems to be it…

How are you changing the mode? It sounds like you also need to set MAV_MODE_FLAG_SAFETY_ARMED in the mode field, but it’s not clear how you’re requesting the change. Take a look at MAV_MODE_FLAG in the mavlink spec. http://mavlink.org/messages/common

Ah, I see now. The flags are absolute, not additive, ok, thanks, that fixed it.