I simulated vtol in gazebo to control offboard mode in FW mode, using /mavros/setpoint_raw/local ros topic, but px4 sitl only responded to my position information, other speed and attitude information did not respond (switch to Throttle variable is 0 after offboard mode), I make sure my type_mask is correct.
@dou This is the expected behavior, depending on the type mask you are sending.
If you are sending position setpoints, you are interacting with the position controller, which generates attitude and throttle setpoints.
Hi, Here is the code I used test it. I hope to get yours answers.
import rospy from mavros_msgs.msg import PositionTarget from mavros_msgs.srv import CommandBool, SetMode from geometry_msgs.msg import PoseStamped, Pose from std_msgs.msg import String,Header import sys rospy.init_node('demo') rate = rospy.Rate(50) target_motion = PositionTarget() target_motion_pub = rospy.Publisher("/mavros/setpoint_raw/local", PositionTarget, queue_size=1) id=0 while not rospy.is_shutdown(): id=id+1 target_motion.header.seq=id target_motion.header.stamp = rospy.Time.now() target_motion.coordinate_frame = 8 # target_motion.type_mask =eval('0b010111000000') target_motion.type_mask =eval('0b100111000111') target_motion.position.x = 0 target_motion.position.y = 0 target_motion.position.z = 0 target_motion.velocity.x=0 target_motion.velocity.y=0 target_motion.velocity.z=0 target_motion.yaw_rate=0 target_motion_pub.publish(target_motion) print(target_motion) try: rate.sleep() except: continue