示例#1
0
        protected override void ParseElements()
        {
            always_on   = GetValue <bool>("always_on");
            update_rate = GetValue <double>("update_rate");
            visualize   = GetValue <bool>("visualize");

            // Console.WriteLine("[{0}] P:{1} C:{2}", GetType().Name, parent, child);

            switch (Type)
            {
            case "gpu_ray":
            case "ray":
            case "lidar":
                if (IsValidNode("ray"))
                {
                    sensor = ParseRay();
                }
                break;

            case "multicamera":
                if (IsValidNode("camera"))
                {
                    var cameras = new Cameras();
                    cameras.name = "multiple_camera";

                    var nodes = GetNodes("camera");
                    // Console.WriteLine("totalCamera: " + nodes.Count);

                    for (var index = 1; index <= nodes.Count; index++)
                    {
                        cameras.list.Add(ParseCamera(index));
                    }

                    sensor = cameras;
                }
                break;

            case "camera":
            case "depth":
            case "wideanglecamera":
                if (IsValidNode("camera"))
                {
                    sensor = ParseCamera();
                }
                break;

            case "sonar":
                if (IsValidNode("sonar"))
                {
                    sensor = ParseSonar();
                }
                break;

            case "imu":
                if (IsValidNode("imu"))
                {
                    sensor = ParseIMU();
                }
                break;

            case "gps":
                if (IsValidNode("gps"))
                {
                    sensor = ParseGPS();
                }
                break;

            case "contact":
                if (IsValidNode("contact"))
                {
                    sensor = ParseContact();
                }
                break;

            default:
                Console.WriteLine("Not supported sensor type!!!!! => " + Type);
                break;
            }

            // Set common
            try
            {
                sensor.name = Name;
                sensor.type = Type;
                // Console.WriteLine("Sensor {0}::{1} was created!", Name, Type);
            }
            catch
            {
                Console.WriteLine("sensor was not created!");
            }

            plugins = new Plugins(root);
        }
示例#2
0
        protected override void ParseElements()
        {
            always_on   = GetValue <bool>("always_on");
            update_rate = GetValue <double>("update_rate");
            visualize   = GetValue <bool>("visualize");
            topic       = GetValue <string>("topic");

            // Console.WriteLine("[{0}] P:{1} C:{2}", GetType().Name, parent, child);

            switch (Type)
            {
            case "ray":
            case "gpu_ray":
            case "lidar":
            case "gpu_lidar":
                if (IsValidNode("lidar"))
                {
                    sensor = ParseLidar();
                }
                else if (IsValidNode("ray"))
                {
                    sensor = ParseLidar("ray");
                }
                break;

            case "rgbd_camera":
            case "rgbd":
            case "multicamera":
                if (IsValidNode("camera"))
                {
                    var cameras = new Cameras();
                    cameras.name = Type;
                    cameras.type = Type;

                    var nodes = GetNodes("camera");
                    // Console.WriteLine("totalCamera: " + nodes.Count);

                    for (var index = 1; index <= nodes.Count; index++)
                    {
                        cameras.Add(ParseCamera(index));
                    }

                    sensor = cameras;
                }
                break;

            case "camera":
            case "depth_camera":
            case "depth":
                if (IsValidNode("camera"))
                {
                    sensor = ParseCamera();
                }
                break;

            case "sonar":
                if (IsValidNode("sonar"))
                {
                    sensor = ParseSonar();
                }
                break;

            case "imu":
                sensor = ParseIMU();
                break;

            case "gps":
            case "navsat":
                sensor = ParseNavSat(Type);
                break;

            case "contact":
                sensor = ParseContact();
                break;

            case "air_pressure":
            case "altimeter":
            case "force_torque":
            case "logical_camera":
            case "boundingbox_camera":
            case "segmentation_camera":
            case "magnetometer":
            case "rfid":
            case "rfidtag":
            case "thermal_camera":
            case "thermal":
            case "wireless_receiver":
            case "wireless_transmitter":
            case "custom":
                Console.WriteLine("Not supported sensor type!!!!! => " + Type);
                break;

            default:
                Console.WriteLine("Invalid sensor type!!!!! => " + Type);
                break;
            }

            // Set common
            try
            {
                sensor.name = Name;
                sensor.type = Type;
                // Console.WriteLine("Sensor {0}::{1} was created!", Name, Type);
            }
            catch
            {
                Console.WriteLine("Sensor {0}::{1} was NOT created!", Name, Type);
            }

            plugins = new Plugins(root);
        }