39 #include <std_msgs/Float64.h> 44 int main(
int argc,
char** argv)
47 const int fd = fileno(stdin);
49 tcgetattr(fd, &prev_flags) ;
52 flags.c_lflag &= ~ICANON;
54 flags.c_cc[VTIME] = 0;
55 tcsetattr(fd,TCSANOW,&flags);
57 ros::init(argc, argv,
"keyboard_float_generator");
63 const double increment = .01;
65 ROS_INFO(
"Press '=' to increment, and '-' to decrement");
67 std_msgs::Float64 shift_val;
73 bool should_publish =
false;
78 case '=': shift_val.data += increment; should_publish =
true;
break;
79 case '+': shift_val.data += increment; should_publish =
true;
break;
80 case '-': shift_val.data -= increment; should_publish =
true;
break;
88 ROS_INFO(
"Publishing Float: % .3f", shift_val.data);
93 tcsetattr(fd,TCSANOW, &prev_flags) ;
void publish(const boost::shared_ptr< M > &message) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
int main(int argc, char **argv)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)