I’m moving to attitude setpoints (/mavros/setpoint_attitude/attitude) from velocity setpoints (/mavros/setpoint_raw/local) and now I cannot enable offboard mode on the vehicle. Offboard has worked fine using the velocity setpoints.
This is the code I am using to publish attitude setpoints and thrust setpoints:
#Move message attPub = rospy.Publisher("/mavros/setpoint_attitude/attitude", PoseStamped, queue_size = 1) attHead = Header() attMsg = PoseStamped() attPose = Pose() attPoint = Point() attQuat = Quaternion() #Header attHead.seq = loopnum attHead.stamp.secs = time.time() #Quaternion attQuat.w = 1 attQuat.x = 0 attQuat.y = 0 attQuat.z = 0 #Point attPoint.x = self.dronePosX attPoint.y = self.dronePosY attPoint.z = self.dronePosZ #Set attitude and rate attPose.orientation = attQuat attPose.position = attPoint attMsg.header = attHead attMsg.pose = attPose #Publish message attPub.publish(attMsg) #Throttle thrPub = rospy.Publisher("/mavros/setpoint_attitude/thrust", Thrust, queue_size = 1) thrMsg = Thrust() thrMsg.header = attHead thrMsg.thrust = 0.5 thrPub.publish(thrMsg) loopnum += 1
The vehicle isn’t getting any mavlink messages when I use these commands, so of course it won’t go into offboard. Am I missing something or formatting something wrong causing MAVROS not to send messages to the flight controller?