I have a ROS node that seems to exit immediately or not even run at all. I have test print statements before the main loop and it never seems to get to that point. roscore is running and no error messages appear in the terminal window.
#include <ros/ros.h>
#include <iostream>
#define ROS_LOOP_RATE 2000
int main(int argc, char* argv[])
{
std::cout << "TEST1\n";
ros::init(argc, argv, "network_wdg_node");
std::cout << "TEST2\n";
ros::NodeHandle wdgNodeHandle("~");
std::cout << "TEST3\n";
ros::Rate loop_rate(ROS_LOOP_RATE);
std::cout << "TEST4\n";
while(ros::ok())
{
std::cout << "INSIDE LOOP\n";
ros::spinOnce();
loop_rate.sleep();
}
return 0;
}
Here's my terminal output:
[rosrun] Looking in catkin libexec dirs:
/home/catkin_ws/devel/lib/test
/home/catkin_ws/devel/share/test
/home/catkin_ws/src/test
[rosrun] Looking in rospack dir: /home/catkin_ws/src/test
[rosrun] Searching for network_wdg_node with permissions /111
[rosrun] Running /home/catkin_ws/devel/lib/network_wdg/test_node
I can't seem to figure out why the node doesn't start running or even get to the first debug statement.
strace -p <pid>
on the process and see what it's doing, if anything. $\endgroup$