Arduplane:can't publish velocity via /mavros/setpoint_velocity/cmd_vel

I have a problem with publishing velocity and position via mavros to arduplane. I rosrun the code and the transition goes all smoothly but when it gets to the part where I publish (local) velocity or position, the arduplane keeps loitering. I don’t have such problems with arducopter. I also checked the mavros state and there wasn’t a problem there either. Can someone please help? Here is the related part of the code and the mavros topics:
//////////
ros::Publisher local_pos_pub = nh.advertise<geometry_msgs::PoseStamped>
(“mavros/setpoint_position/local”, 10);
//////////
ros::Publisher local_vel_pub=nh.advertise<geometry_msgs::TwistStamped>
(“/mavros/setpoint_velocity/cmd_vel”, 10);

ROS_INFO("Starting survey...");
geometry_msgs::TwistStamped velocity;
// Set velocity commands for the survey
double fixed_velocity = 10.0; // m/s
for (int i = 0; i < 4; i++) {
    while (ros::ok() && (abs(current_pose.pose.position.x - targets[i].first) > 5 || abs(current_pose.pose.position.y - targets[i].second) > 5)) {
        ROS_INFO("Moving to waypoint" , targets[i]);
        double delta_x = targets[i].first - current_pose.pose.position.x;
        double delta_y = targets[i].second - current_pose.pose.position.y;
        double distance = sqrt(delta_x * delta_x + delta_y * delta_y);
        velocity.twist.linear.x = fixed_velocity * (delta_x / distance);
        velocity.twist.linear.y = fixed_velocity * (delta_y / distance);
        velocity.twist.linear.z = 0;

        local_vel_pub.publish(velocity);

        ROS_INFO("Velocity: x: %f, y: %f", velocity.twist.linear.x, velocity.twist.linear.y);
        ROS_INFO("Current position: x: %f, y: %f", current_pose.pose.position.x, current_pose.pose.position.y);
        ros::spinOnce();
        rate.sleep();
    }

}