Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

readData and writeData function for ColorOctree visualization is giving white color in RVIZ els


I am creating a colored octomap "ColorOcTree" and I save it using writeData function. I am calling the function writeData using the following lines:

  std::ofstream file1("map1.ot", std::ios_base::out );

I tired both .ot and .dat file extensions.

The function writeData is as follows:

std::ostream& writeData(std::ostream& s) const
    s.write((const char*)&value, sizeof(value));  // occupancy
    s.write((const char*)&color, sizeof(Color));  // color
    return s;

After that, I close the simulation and I tried to read the file by calling the readData function using the following lines:

  std::ifstream s("map1.ot", std::ios_base::in );
  octomap_.readData(s) ;

The readData function is as follows:

std::istream& readData(std::istream& s)
{*)&value, sizeof(value));  // occupancy*)&color, sizeof(Color));  // color
     return s;

When I visualize the map in RVIZ, all the voxels are white. But when I tried to print the values in the terminal, I got different values than 255, 255, 255

Kindly help