I am working on an exploration problem and trying to compute the expected information gain by using a sensor model and ray-casting as part of this effort. I am not so experienced with C++, so I hope this is not a very basic syntax or form based error.
However, when using the computeRay function, I am getting a segmentation fault that is backtraced to OcTreeBaseImpl.hxx:
#0 0x00002aaaaba084ce in std::vector<octomap::KeyRay, std::allocator<octomap::KeyRay> >::size (this=0xa0) at /usr/include/c++/5/bits/stl_vector.h:655
#1 0x00002aaaaba0789e in std::vector<octomap::KeyRay, std::allocator<octomap::KeyRay> >::_M_range_check (this=0xa0, __n=0)
#2 0x00002aaaaba0474f in std::vector<octomap::KeyRay, std::allocator<octomap::KeyRay> >::at (this=0xa0, __n=0) at /usr/include/c++/5/bits/stl_vector.h:824
#3 0x00002aaaaba00785 in octomap::OcTreeBaseImpl<octomap::OcTreeNode, octomap::AbstractOccupancyOcTree>::computeRay (this=0x0, origin=..., end=...,
_ray=std::vector of length 0, capacity 0)
When calling the function within my own code, I instantiate the inputs as follows:
Both of these contain non-zero 3D point values.
Then I instantiate:
as the vector where I want all the keys of the nodes that the ray passes through are saved.
with octree_tmp instantiated as:
it is private in my class.
The issue seems to be that "this" is seen to be as empty causing issues further down the line, and from my understanding this object is based on my input of std::vector<octomath::Vector3> ray, but I believe this should be unassigned going into the function with push_back being used inside to increase its size as needed.
I do not know what I can change on my side and would appreciate any advice in tackling this issue.
Thank you and kind regards,