0
$\begingroup$

Rosanswers logo

Hello, I am trying to load a nodelet multiple times. But the node is getting crashed once the second instance of the node let started executing.

Below snippet describes the way I am loading the nodelet.

std::string name = ros::this_node::getName() + "instance1";
my_argv.push_back("instance1");
my_argv.push_back("0");
my_argv.push_back("10");
manager.load(name, "myNodelet/exNodelet", remappings, my_argv);


my_argv.clear();
my_argv.push_back("instance2");
my_argv.push_back("0");
my_argv.push_back("10");
name = ros::this_node::getName() + "instance2";
manager.load(disparity_name, "myNodelet/exNodelet", remappings, my_argv);


my_argv.clear();
my_argv.push_back("instance3);
my_argv.push_back("11");
my_argv.push_back("10");
name = ros::this_node::getName() + "instance3";
manager.load(name, "myNodelet/exNodelet", remappings, my_argv);

Can anyone give any clue on why the second instance(not instance2. If I launch instance2 first then it will run perfect. The instance, launched 2nd getting crashed.) getting crashed.

Note: I am using OpenCV library in my nodelet.

Edit: I have debugged the problem further. I have noticed, when I commented OpenCV call the nodelet is launched perfectly in the second instance.

Please have a look at the gdb trace below

#0 0x00007f81913e3525 in ?? () from /opt/ros/kinetic/lib/libopencv_calib3d3.so.3.1 #1 0x00007f81913e3cd7 in ?? () from /opt/ros/kinetic/lib/libopencv_calib3d3.so.3.1 #2 0x00007f81913e679f in ?? () from /opt/ros/kinetic/lib/libopencv_calib3d3.so.3.1 #3 0x00007f81ec556cb7 in stereo_vision::stereoReconstruct::process (this=0xff9960, l_image_msg=..., l_info_msg=..., r_image_msg=..., r_info_msg=...) at /home/swahana/Murali/catkin_ws_nodelets/src/stereo_vision/src/nodelet/stereoReconstruct.cpp:271 #4 0x00007f81ec56f606 in boost::function9<void, boost::shared_ptr<sensor_msgs::Image_std::allocator<void > const> const&, boost::shared_ptr<sensor_msgs::CameraInfo_std::allocator<void > const> const&, boost::shared_ptr<sensor_msgs::Image_std::allocator<void > const> const&, boost::shared_ptr<sensor_msgs::CameraInfo_std::allocator<void > const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&>::operator() (a8=..., a7=..., a6=..., a5=..., a4=..., a3=..., a2=..., a1=..., a0=..., this=) at /usr/include/boost/function/function_template.hpp:773

Thanks in advance


Originally posted by mkreddy477 on ROS Answers with karma: 58 on 2017-03-30

Post score: 0


Original comments

Comment by gvdhoorn on 2017-03-30:
Do you absolutely need to use the manager directly (ie: as a local C++ object)? Any reason you can't use the regular nodelet manager node and the service interface provided by it?

Comment by mkreddy477 on 2017-03-30:
The manager used here is a regular nodelet manager. I have found from the debug information and the trails I have made by commenting OpenCV call, the issue is with the Opencv call not with the ROS.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I was able to solve the issue. I have declared the OpenCV class object as a global variable. This was causing the problem. Now I made that as a nodelet subclass variable.


Originally posted by mkreddy477 with karma: 58 on 2017-03-31

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.