ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Because the data of OccupancyGrid
is of type int8
, even if you assign a float32
type, it does not store the value as it should.
The solution is different depending on the purpose of using OccupancyGrid
, but for example, the following can be used.
Multiply the data in std_msgs::Float32MultiArray
by 100, cast it to int8
, and store it in the OccupancyGrid. Then divide it by 100 at the destination where it will be used.
ref: http://docs.ros.org/melodic/api/nav_msgs/html/msg/OccupancyGrid.html