void MapChange(RosMap mapMsg)
    {
        _mapData = mapMsg.data;
        _mapInfo = mapMsg.info;

        float sizez = _mapInfo.width * _mapInfo.resolution;
        float sizex = _mapInfo.height * _mapInfo.resolution;

        Vector3 OriginUnity = new Vector3(-(float)_mapInfo.origin.position.y, (float)_mapInfo.origin.position.z, (float)_mapInfo.origin.position.x);

        //_mapOrigin.position = _conversion.ros2unityCoord(_mapInfo.origin.position);
        //_mapOrigin.rotation = _conversion.ros2unityOrientation(_mapInfo.origin.orientation);

        meshVerticies[0] = new Vector3(0f, 0f, 0f);
        meshVerticies[1] = new Vector3(-sizex, 0f, 0f);
        meshVerticies[2] = new Vector3(0f, 0f, sizez);
        meshVerticies[3] = new Vector3(-sizex, 0f, sizez);

        mesh.vertices = meshVerticies;

        _recievedMap.Resize(((int)_mapInfo.width), ((int)_mapInfo.height));
        _recievedMap.LoadRawTextureData((byte[])(System.Array)_mapData);
        _recievedMap.Apply();

        meshRenderer.material.SetTexture("_MainTex", _recievedMap);
        mesh.RecalculateBounds();

        uvs    = new Vector2[4];
        uvs[0] = new Vector2(0, 0);
        uvs[1] = new Vector2(0, 1);
        uvs[2] = new Vector2(1, 0);
        uvs[3] = new Vector2(1, 1);

        mesh.uv = uvs;

        Vector3[] normals = mesh.normals;

        for (int i = 0; i < normals.Length; i++)
        {
            normals[i] = Vector3.up;
        }

        mesh.normals = normals;

        MapMesh.transform.localPosition = OriginUnity;
        MapMesh.transform.localScale    = new Vector3(1f, 1f, 1f);
    }
 public OccupancyGridMsg(Std.HeaderMsg header, MapMetaDataMsg info, sbyte[] data)
 {
     this.header = header;
     this.info   = info;
     this.data   = data;
 }
 private OccupancyGridMsg(MessageDeserializer deserializer)
 {
     this.header = Std.HeaderMsg.Deserialize(deserializer);
     this.info   = MapMetaDataMsg.Deserialize(deserializer);
     deserializer.Read(out this.data, sizeof(sbyte), deserializer.ReadLength());
 }
 public OccupancyGridMsg()
 {
     this.header = new Std.HeaderMsg();
     this.info   = new MapMetaDataMsg();
     this.data   = new sbyte[0];
 }