publish cmd_vel !!
hello guys
how can i publish cmd_vel at for instance 20 times per sec ?? where should this be included ??
velPub = nh.advertise<geometry_msgs::Twist>("/agv1/cmd_vel", 20);
this way ??
int main(int argc, char** argv)
{
ros::init(argc, argv, "image_processor");
ros::NodeHandle nh;
image_transport::ImageTransport it(nh);
cv::namedWindow("blob");
cv::createTrackbar("LowerH", "blob", &LowerH, 179, NULL);
cv::createTrackbar("UpperH", "blob", &UpperH, 179, NULL);
cv::createTrackbar("LowerS", "blob", &LowerS, 255, NULL);
cv::createTrackbar("UpperS", "blob", &UpperS, 255, NULL);
cv::createTrackbar("LowerV", "blob", &LowerV, 255, NULL);
cv::createTrackbar("UpperV", "blob", &UpperV, 255, NULL);
//cv::namedWindow(WINDOW, CV_WINDOW_AUTOSIZE);
//cv::namedWindow(RESULT, CV_WINDOW_AUTOSIZE);
ros::Subscriber dep;
dep = nh.subscribe("/camera/depth_registered/points", 1, depthcallback);
image_transport::Subscriber sub = it.subscribe("/camera/rgb/image_rect_color", 1, blobDetectionCallback);
followmemsg_pub = nh.advertise<blobdetection::Followmemsg>("/agv1/bt/followmemsg", 10);
//follow_msg.person == 1;
ros::ServiceServer service = nh.advertiseService("followmeservice", followmesrv);
velPub = nh.advertise<geometry_msgs::Twist>("/agv1/cmd_vel", 20);
pub = it.advertise("camera/image_processed", 1);
ros::Rate rate(20.0);
geometry_msgs::Twist speed;
int count = 1;
while (nh.ok())
{
std_msgs::String msg;
ros::Publisher velPub;
//std::stringstream ss;
if (hasNewPcl && isStop == true || isStart == true)
{
getXYZ(posX, posY);
hasNewPcl = false;
}
ros::spinOnce();
rate.sleep();
}
}
please help..
thanks