Go to the documentation of this file.00001
00036 #include "ros/ros.h"
00037 #include "std_msgs/Float64.h"
00038
00039 int main(int argc, char **argv)
00040 {
00041 ros::init(argc, argv, "setpoint_node");
00042 ROS_INFO("Starting setpoint publisher");
00043 ros::NodeHandle setpoint_node;
00044
00045 while (ros::Time(0) == ros::Time::now())
00046 {
00047 ROS_INFO("Setpoint_node spinning waiting for time to become non-zero");
00048 sleep(1);
00049 }
00050
00051 std_msgs::Float64 setpoint;
00052 setpoint.data = 1.0;
00053 ros::Publisher setpoint_pub = setpoint_node.advertise<std_msgs::Float64>("setpoint", 1);
00054
00055 ros::Rate loop_rate(0.2);
00056
00057 while (ros::ok())
00058 {
00059 ros::spinOnce();
00060
00061 setpoint_pub.publish(setpoint);
00062 setpoint.data = 0 - setpoint.data;
00063 setpoint_pub.publish(setpoint);
00064
00065 loop_rate.sleep();
00066 }
00067 }