File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -56,17 +56,20 @@ int main(int argc, char *argv[]) {
5656 // Set up the COM port
5757 std::string com_port;
5858 int baud_rate;
59+ int loop_rate;
5960 std::string imu_frame_id;
6061 std::string nav_sat_frame_id;
6162 std::string topic_prefix;
6263
6364 if (argc >= 3 ) {
6465 com_port = std::string (argv[1 ]);
6566 baud_rate = atoi (argv[2 ]);
67+ loop_rate = atoi (argv[3 ]);
6668 }
6769 else {
6870 pnh.param (" port" , com_port, std::string (" /dev/ttyUSB0" ));
6971 pnh.param (" baud_rate" , baud_rate, 115200 );
72+ pnh.param (" loop_rate" , loop_rate, 100 );
7073 }
7174
7275 pnh.param (" imu_frame_id" , imu_frame_id, std::string (" imu" ));
@@ -144,6 +147,8 @@ int main(int argc, char *argv[]) {
144147
145148 an_decoder_initialise (&an_decoder);
146149
150+ ros::Rate loop (loop_rate);
151+
147152 // Loop continuously, polling for packets
148153 while (ros::ok ())
149154 {
@@ -416,6 +421,8 @@ int main(int argc, char *argv[]) {
416421 filter_status_pub.publish (filter_status_msg);
417422 }
418423 }
424+
425+ loop_rate.sleep ();
419426 }
420427
421428}
You can’t perform that action at this time.
0 commit comments