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);
    }
Esempio n. 2
0
 private LoadMapResponse(MessageDeserializer deserializer)
 {
     this.map = OccupancyGridMsg.Deserialize(deserializer);
     deserializer.Read(out this.result);
 }
Esempio n. 3
0
 public LoadMapResponse(OccupancyGridMsg map, byte result)
 {
     this.map    = map;
     this.result = result;
 }
Esempio n. 4
0
 public LoadMapResponse()
 {
     this.map    = new OccupancyGridMsg();
     this.result = 0;
 }
Esempio n. 5
0
 private GetMapResult(MessageDeserializer deserializer)
 {
     this.map = OccupancyGridMsg.Deserialize(deserializer);
 }
Esempio n. 6
0
 public GetMapResult(OccupancyGridMsg map)
 {
     this.map = map;
 }
Esempio n. 7
0
 public GetMapResult()
 {
     this.map = new OccupancyGridMsg();
 }