ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
if you want change rate of the loop when the program run you must use Dynamic Reconfigure parameter
if you want to set rate of the loop when you run the program you can use this command:
rosrun publisher_package PublisherNode ra:=50
2 | No.2 Revision |
if you want change rate of the loop when the program run nide is runnig you must use Dynamic Reconfigure parameter
if you want to set rate of the loop when you run start the program node you can use this command:
rosrun publisher_package PublisherNode ra:=50
3 | No.3 Revision |
if you want change rate of the loop when the nide is runnig you must use Dynamic Reconfigure parameter
if you want to set rate of the loop when you start the node you can use this command:
rosrun publisher_package PublisherNode ra:=50
#include "ros/ros.h"
#include "performance_tests/SuperAwesome.h"
#include <sstream>
int main(int argc, char **argv)
{
ros::init(argc, argv, "PublisherNode");
ros::NodeHandle nh;
int ra;
n.param("my_num", ra,100);
ros::Publisher msg_pub = nh.advertise<performance_tests::SuperAwesome>("publisher", 1000);
// I want to change the rate value through the value I receive in through ra.
ros::Rate rate(ra);
int count = 0;
while (ros::ok())
{
performance_tests::SuperAwesome msg;
std::stringstream s;
s <<"Hello World " << count;
msg.data = s.str();
ROS_INFO("%s",msg.data.c_str());
msg_pub.publish(msg);
ros::spinOnce();
rate.sleep();
count++;
}
return 0;
}
4 | No.4 Revision |
if you want change rate of the loop when the nide node is runnig you must use Dynamic Reconfigure parameter
if you want to set rate of the loop when you start the node you can use this command:
rosrun publisher_package PublisherNode ra:=50
#include "ros/ros.h"
#include "performance_tests/SuperAwesome.h"
#include <sstream>
int main(int argc, char **argv)
{
ros::init(argc, argv, "PublisherNode");
ros::NodeHandle nh;
int ra;
n.param("my_num", ra,100);
ros::Publisher msg_pub = nh.advertise<performance_tests::SuperAwesome>("publisher", 1000);
// I want to change the rate value through the value I receive in through ra.
ros::Rate rate(ra);
int count = 0;
while (ros::ok())
{
performance_tests::SuperAwesome msg;
std::stringstream s;
s <<"Hello World " << count;
msg.data = s.str();
ROS_INFO("%s",msg.data.c_str());
msg_pub.publish(msg);
ros::spinOnce();
rate.sleep();
count++;
}
return 0;
}
5 | No.5 Revision |
if you want change rate of the loop when the node is runnig you must use Dynamic Reconfigure parameter use this
if you want to set rate of the loop when you start the node you can command:command and code:
rosrun publisher_package PublisherNode ra:=50
#include "ros/ros.h"
#include "performance_tests/SuperAwesome.h"
#include <sstream>
int main(int argc, char **argv)
{
ros::init(argc, argv, "PublisherNode");
ros::NodeHandle nh;
int ra;
n.param("my_num", ra,100);
ros::Publisher msg_pub = nh.advertise<performance_tests::SuperAwesome>("publisher", 1000);
// I want to change the rate value through the value I receive in through ra.
ros::Rate rate(ra);
int count = 0;
while (ros::ok())
{
performance_tests::SuperAwesome msg;
std::stringstream s;
s <<"Hello World " << count;
msg.data = s.str();
ROS_INFO("%s",msg.data.c_str());
msg_pub.publish(msg);
ros::spinOnce();
rate.sleep();
count++;
}
return 0;
}
6 | No.6 Revision |
use this command and code:
rosrun publisher_package PublisherNode ra:=50
#include "ros/ros.h"
#include "performance_tests/SuperAwesome.h"
#include <sstream>
int main(int argc, char **argv)
{
ros::init(argc, argv, "PublisherNode");
ros::NodeHandle nh;
int ra;
n.param("my_num", n.param("ra", ra,100);
ros::Publisher msg_pub = nh.advertise<performance_tests::SuperAwesome>("publisher", 1000);
// I want to change the rate value through the value I receive in through ra.
ros::Rate rate(ra);
int count = 0;
while (ros::ok())
{
performance_tests::SuperAwesome msg;
std::stringstream s;
s <<"Hello World " << count;
msg.data = s.str();
ROS_INFO("%s",msg.data.c_str());
msg_pub.publish(msg);
ros::spinOnce();
rate.sleep();
count++;
}
return 0;
}
7 | No.7 Revision |
use this command and code:
rosrun publisher_package PublisherNode
ra:=50_my_param:=1
#include "ros/ros.h"
#include "performance_tests/SuperAwesome.h"
#include <sstream>
int main(int argc, char **argv)
{
ros::init(argc, argv, "PublisherNode");
ros::NodeHandle nh;
nh("~");
int ra;
n.param("ra", nh.param("my_param", ra,100);
ros::Publisher msg_pub = nh.advertise<performance_tests::SuperAwesome>("publisher", 1000);
// I want to change the rate value through the value I receive in through ra.
ros::Rate rate(ra);
int count = 0;
while (ros::ok())
{
performance_tests::SuperAwesome msg;
std::stringstream s;
s <<"Hello World " << count;
msg.data = s.str();
ROS_INFO("%s",msg.data.c_str());
msg_pub.publish(msg);
ros::spinOnce();
rate.sleep();
count++;
}
return 0;
}