ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Crash while launching multiple instances of same nodelet

asked 2017-03-30 08:29:33 -0500

mkreddy477 gravatar image

updated 2017-03-30 23:42:12 -0500

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=<optimized out="">) at /usr/include/boost/function/function_template.hpp:773

Thanks in advance

edit retag flag offensive close merge delete

Comments

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?

gvdhoorn gravatar image gvdhoorn  ( 2017-03-30 15:06:27 -0500 )edit

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.

mkreddy477 gravatar image mkreddy477  ( 2017-03-30 22:13:35 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-03-31 08:10:24 -0500

mkreddy477 gravatar image

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-03-30 08:29:33 -0500

Seen: 247 times

Last updated: Mar 31 '17