Closed SansoneG closed 4 years ago
Thanks Guiseppe. I assume you also started a launchfile for the robot and moveit. Could you please also add details on that.
I ran roslaunch prbt_default_application my_application.launch sim:=false
Should probably check if this also happens in simulation
I did a quick check. I ran:
roslaunch prbt_moveit_config moveit_planning_execution.launch sim:=true pipeline:=pilz_command_planner
and
rosrun pilz_robot_programming demo_program.py
The output was exactly the same as above.
Found another error which is reported at the end of the script:
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >'
There seems to be a problem with the destruction of the robot object. I created a minimal example:
Approx. 4 failures (segfault) out of 10 runs. No failures if you remove the __del__
method.
#!/usr/bin/env python
import rospy
from moveit_commander import RobotCommander
from std_srvs.srv import Trigger
PLANNING_GROUP_NAME = "manipulator"
TEST_SERVICE_NAME = "test_service"
class TestClass(object):
def __init__(self):
self._service = rospy.Service(TEST_SERVICE_NAME, Trigger, self._callback)
self._robot_commander = RobotCommander()
self._robot_commander.get_group(PLANNING_GROUP_NAME).get_current_joint_values()
self._service.shutdown()
def _callback(self, request):
return True
if __name__ == "__main__":
rospy.init_node('moveit_commander_test_node')
test = TestClass()
#0 0x0000000000000008 in ?? ()
#1 0x00007ffff364e7fd in ros::Subscription::handleMessage(ros::SerializedMessage const&, bool, bool, boost::shared_ptr<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&, boost::shared_ptr<ros::PublisherLink> const&) () from /opt/ros/melodic/lib/libroscpp.so
#2 0x00007ffff362dcbd in ros::TransportPublisherLink::handleMessage(ros::SerializedMessage const&, bool, bool) () from /opt/ros/melodic/lib/libroscpp.so
#3 0x00007ffff362ddec in ros::TransportPublisherLink::onMessage(boost::shared_ptr<ros::Connection> const&, boost::shared_array<unsigned char> const&, unsigned int, bool) ()
from /opt/ros/melodic/lib/libroscpp.so
#4 0x00007ffff35af20c in ros::Connection::readTransport() () from /opt/ros/melodic/lib/libroscpp.so
#5 0x00007ffff36288dd in ros::TransportTCP::socketUpdate(int) ()
from /opt/ros/melodic/lib/libroscpp.so
#6 0x00007ffff365f423 in ros::PollSet::update(int) () from /opt/ros/melodic/lib/libroscpp.so
#7 0x00007ffff35ea355 in ros::PollManager::threadFunc() () from /opt/ros/melodic/lib/libroscpp.so
#8 0x00007ffff2679bcd in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1
#9 0x00007ffff77cc6db in start_thread (arg=0x7fffcb7fe700) at pthread_create.c:463
#10 0x00007ffff7b05a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Conclusion from 2020-07-09:
close
/release
method for Robot
class and/or recommend using with
-statements in order to ensure proper destruction of Robot
objects.It seems like calling del
on the RobotCommander
in the on_shutdown
callback (rospy.on_shutdown(cb)
) prevents the segfault
Strange that this service is needed to trigger the issue.
For me it sound like an issue with the Subscriber listening to /joint_states is not properly shut down....
Commit
59f80849ff
Steps to reproduce
Observed behavior
Everything is excecuted as expected, but at the end segmentation fault is reported.
Logfiles