The MarkerArray for visualization of the octomap is colored based on the z value of the lowest and highest cell in your octomap. So when you start, let's say your octomap has cells from 0.2m to 0.6m height. The color range is adjusted so 0.2m appears blue and 0.6m appears red (or something like that). As you move your robot around, the robot also sees cells in a height from 0.1m to 1.6m. The coloring then is changed so it spans the whole 1.5m range, explaining why previous cells change color. What is "correct" of course depends entirely on your use case.
Originally posted by Stefan Kohlbrecher with karma: 24361 on 2013-05-05
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by elva on 2013-05-05:
thank you for the reply,your example make it easier for me to understand but my problem is : the laser tilts horizontally , the first scan can detect the ground and ceiling already,so the z value doesn't change. and i didn't move the robot ,btw i use laser_assemble to collect the point cloud:)