Sometimes when I publish to cmd_vel node got stuck
Hi! I am working with the ardrone_autonomy package for the Ar.Drone. I have already a code for the control signal and it works great, except for the part when I try to publish the commands in the cmd_vel topic. Normally it publish fast, which is what i need, but sometimes it kinda freeze, for 1 or 2 seconds, and goes back to publishing normally. I dont know why is that happening, und is very important for me to fix that delay, because in that 2 seconds the Drone could crash. Here is the relevant part of the code: Inside the main:
ros::init(argc, argv, "tracker");
ros::NodeHandle nh;
ros::Rate loop_rate(50);
Inside the callback:
ros::NodeHandle neu;
ros::Publisher pub_empty_land;
ros::Publisher pub_point=neu.advertise<geometry_msgs::Point>("color_position",1);
ros::Publisher pub_control=neu.advertise<geometry_msgs::Twist>("/cmd_vel", 10);
twist_msg.linear.x=Control.at<float>(2);
twist_msg.linear.y=Control.at<float>(0);
twist_msg.linear.z=Control.at<float>(1);
pub_point.publish(posptav);
pub_control.publish(twist_msg);
cv::waitKey(15);
ros::spinOnce();
I would appreciate your help Thanks!