Example #1
0
        private void SearchForGenerators(string file)
        {
            Type     baseclass = typeof(PathGenerator);
            Assembly assembly  = System.Reflection.Assembly.LoadFile(file);

            foreach (Type type in assembly.GetTypes())
            {
                if (type.IsClass && !type.IsAbstract && type.IsSubclassOf(baseclass))
                {
                    PathGenerator gen = (PathGenerator)Activator.CreateInstance(type);
                    m_generators.Add(gen);
                }
            }
        }
Example #2
0
        public void GenerateSegments(RobotParams robot, PathGenerator gen)
        {
            bool needgen = false;

            lock (m_lock)
            {
                if (m_segments == null || m_segments_dirty)
                {
                    needgen          = true;
                    m_segments       = null;
                    m_segments_dirty = false;
                }
            }

            if (needgen)
            {
                gen.GenerateSegments(robot, this);
            }
        }
Example #3
0
        public void GenerateSplines(PathGenerator gen)
        {
            List <Spline> xsp = new List <Spline>();
            List <Spline> ysp = new List <Spline>();

            gen.GenerateSplines(this, xsp, ysp);
            if (xsp.Count != ysp.Count)
            {
                throw new Exception("Invalid path generator, GenerateSplines returned different number of X and Y splines");
            }

            if (xsp.Count != Points.Length - 1)
            {
                throw new Exception("Invalid path generator, GeneratedSplines did not return N-1 splines for N waypoints");
            }

            m_splines = new Tuple <Spline, Spline> [xsp.Count];

            for (int i = 0; i < xsp.Count; i++)
            {
                Tuple <Spline, Spline> t = new Tuple <Spline, Spline>(xsp[i], ysp[i]);
                m_splines[i] = t;
            }
        }