Not able to run image_transport from cpp code: ` Segmentation fault (core dumped)`
I included well image_transport in both my CMake file and packake.xml as follows:
find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
roscpp
rospy
std_msgs
message_generation
genmsg
)
generate_messages(
DEPENDENCIES
std_msgs
)
catkin_package(
CATKIN_DEPENDS cv_bridge image_transport roscpp rospy std_msgs message_generation
)
....
and
<buildtool_depend>catkin</buildtool_depend>
<build_depend>cv_bridge</build_depend>
<build_depend>image_transport</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>message_generation</build_depend>
<run_depend>cv_bridge</run_depend>
<run_depend>image_transport</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>rospy</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>message_runtime</run_depend>
<run_depend>message_generation</run_depend>
<run_depend>image_transport</run_depend>
and in my .cpp file
#include <ros/ros.h>
#include <image_transport/image_transport.h>
.....
int main(int argc, char **argv)
{
ros::init(argc, argv, "imagegraber");
ros::NodeHandle nodea;
image_transport::ImageTransport it(nodea);
image_transport::Subscriber sub = it.subscribe("/pg_15508342/image_raw", 1, imageCallback);
ros::spin();
return 0;
}
Yet, I receive Segmentation fault (core dumped)
when I run my code.... What could be the problem?
The code crashes at image_transport::ImageTransport it(nodea);
Am also able to run image_transport
with command line: rosrun image_transport republish.....
Able also to use image_view, etc...