# Revision history [back]

Hi,

your problem probably is, that ros::spin is made to contiously request data via subscribers. It does not affect publishers like described in 257361.

I guess your publisher publishes the velocity only once. So we introduce a while loop that repeats at a fixed rate as long as the rosmaster node is active.

ros::Rate loop_rate(10);
geometry_msgs::Twist msg;
while(ros::ok())
{
msg.linear.x = 1;
msg.linear.y = 0;
msg.linear.z = 0;
msg.angular.x = 0;
msg.angular.y = 0;
msg.angular.z = 0;
chatter.publish(msg);
loop_rate.sleep(); //if you want to have somewhat fixed rate publishing
ros::spinOnce();
}


furthermore try removing the first "/" at your frame_id in the advertis statement so you have the following: I am unsure if that makes a difference but this here definately works

chatter = nh.advertise<geometry_msgs::Twist>("rosbot/cmd_vel", 100);


Btw, I dont think you need a that big queue in the publisher probably 5 does the job allready, but this shouldn't make a difference for your problem.

Let me know if this helped you