ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You could use ros::Rate()

ros::NodeHandle n;
ros::Publisher cmd_pub = n.advertise<geometry_msgs::twist>("/cmd_vel", 1000);
ros::Rate loop_rate(10);

while (ros::ok()) {

    cmd_pub(msg);
    loop_rate.sleep();
}

The "loop_rate" is a frequency in Hertz so you can adjust that as needed.

You could use ros::Rate()

ros::NodeHandle n;
ros::Publisher cmd_pub = n.advertise<geometry_msgs::twist>("/cmd_vel", 1000);
ros::Rate loop_rate(10);

while (ros::ok()) {

    cmd_pub(msg);
    loop_rate.sleep();
}

The "loop_rate" is a frequency in Hertz so you can adjust that as needed.needed. See this tutorial for more details.

You could use ros::Rate()

ros::NodeHandle n;
ros::Publisher cmd_pub = n.advertise<geometry_msgs::twist>("/cmd_vel", 1000);
ros::Rate loop_rate(10);

while (ros::ok()) {

    cmd_pub(msg);
    loop_rate.sleep();
}

The "loop_rate" is a frequency in Hertz so you can adjust that as needed. See this tutorial for more details.

You could use ros::Rate()

ros::NodeHandle n;
ros::Publisher cmd_pub = n.advertise<geometry_msgs::twist>("/cmd_vel", 1000);
ros::Rate loop_rate(10);
loop_rate(2);

while (ros::ok()) {

    cmd_pub(msg);
    loop_rate.sleep();
}

The "loop_rate" is a frequency in Hertz so you can adjust that as needed. See this tutorial for more details.

You could use ros::Rate()

ros::NodeHandle n;
ros::Publisher cmd_pub = n.advertise<geometry_msgs::twist>("/cmd_vel", 1000);
ros::Rate loop_rate(2);

while (ros::ok()) {
     cmd_pub(msg);
    loop_rate.sleep();
}

The "loop_rate" is a frequency in Hertz so you can adjust that as needed. See this tutorial for more details.

You could use ros::Rate()

ros::NodeHandle n;
ros::Publisher cmd_pub = n.advertise<geometry_msgs::twist>("/cmd_vel", 1000);
ros::Rate loop_rate(2);

while (ros::ok()) {
    cmd_pub(msg);
cmd_pub.publish(msg);
    loop_rate.sleep();
}

The "loop_rate" is a frequency in Hertz so you can adjust that as needed. See this tutorial for more details.

You could use ros::Rate()

ros::NodeHandle n;
ros::Publisher cmd_pub = n.advertise<geometry_msgs::twist>("/cmd_vel", 1000);
ros::Rate loop_rate(2);

while (ros::ok()) {
    cmd_pub.publish(msg);
    loop_rate.sleep();
}

The "loop_rate" input is a frequency in Hertz so you can adjust that as needed. See this tutorial for more details.