WARN [mavlink] SET_POSITION_TARGET_LOCAL_NED invalid


I have written a function
def circle(self):
msg = PositionTarget()
msg.header.stamp = rospy.Time.now()
msg.coordinate_frame = 8
msg.type_mask = 4088
msg.position.x = 0.0
msg.position.y = 0.0
msg.position.z = -3.0
self.local_raw_publisher.publish(msg)

and I call this function to give setpoints before and after i switch to offboard mode…
How do i solve this?