ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Ok, so there are a few issues here.
If you're already publishing the force/torque data over ROS, is there a reason why you're writing your own data logger instead of using rosbag?
Assuming ft_sensor->ft_subscribe()
is creating a subscriber, when you replace ros::spin()
with ros::spinOnce()
in a loop, you're creating new subscriptions as fast as possible, over and over. Each time you create a subscriber, you are necessitating communication with the ROS master.
If you're already using ROS, then it's not a lot to use boost threads instead of pthreads. On POSIX systems, boost threads are pthreads, but with a more modern c++-like interface which you will find less error-prone.
I suspect you're doing something wonky with threading to keep your program from exiting. Once a SIGINT
(ctrl-c) is received by the program, ros::shutdown()
should be called. If you're doing something to keep that signal from being handled, then when you want ros::ok()
to return false
or ros::spin()
to return, then simply call ros::shutdown()
manually as shown here.