ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The ros::serialization::StreamOverrunException
was caused by a bad memory management between nodelets. Thanks to @gvdhoorn, debugging the code showed that the exception was caused by:
In the first nodelet of the pipeline I was sending a pointer to a PointCloud and forgot to re-allocate the pointer before modifying its contents. The subsequent nodelets therefore received a pointer to a memory location that had changed since the message was sent, causing the error. To sum up, make sure that you do not modify a sent message when working with nodelets.
2 | No.2 Revision |
The ros::serialization::StreamOverrunException
was caused by a bad memory management between nodelets. Thanks to @gvdhoorn, debugging the code showed that the exception was caused by:
In the first nodelet of the pipeline I was sending a pointer to a PointCloud and forgot to re-allocate the pointer before modifying its contents. The subsequent nodelets therefore received a pointer to a memory location that had changed since the message was sent, causing the error. To sum up, make sure that you do not modify a sent message when working with nodelets.
EDIT
In my node, I published 4 messages:
void
SurfaceSegmentationNode::publishMsgs()
{
this->marker_publisher_.publish(this->output_surfaces_markers_->getMarkerArray());
this->surface_publisher_.publish(this->output_surfaces_msg_);
this->full_cloud_publisher_.publish(this->input_cloud_full_);
this->subsampled_cloud_publisher_.publish(this->input_cloud_subsampled_);
}
so before creating any new messages to send, I had to add
void
SurfaceSegmentationNode::resetMsgs()
{
this->input_cloud_full_ = pointCloud::ConstPtr(new pointCloud());
this->input_cloud_subsampled_ = pointCloud::ConstPtr(new pointCloud());
this->output_surfaces_msg_ = scene_msgs::SurfaceArray::Ptr(new scene_msgs::SurfaceArray);
this->output_surfaces_markers_->resetMarkers();
this->surface_segmentation_.surface_vector.clear();
}
to allocate new space for the new messages and not mess with the memory. I hope this clarifies what I meant.