示例#1
0
            public void MessageReceived(LCM.LCM lcm, string channel, LCM.LCMDataInputStream dins)
            {
                Console.WriteLine("RECV: " + channel);

                if (channel == "EXAMPLE")
                {
                    exlcm.example_t msg = new exlcm.example_t(dins);

                    Console.WriteLine("Received message of the type example_t:");
                    Console.WriteLine("  timestamp   = {0:D}", msg.timestamp);
                    Console.WriteLine("  position    = ({0:N}, {1:N}, {2:N})",
                            msg.position[0], msg.position[1], msg.position[2]);
                    Console.WriteLine("  orientation = ({0:N}, {1:N}, {2:N}, {3:N})",
                            msg.orientation[0], msg.orientation[1], msg.orientation[2],
                            msg.orientation[3]);
                    Console.Write("  ranges      = [ ");
                    for (int i = 0; i < msg.num_ranges; i++)
                    {
                        Console.Write(" {0:D}", msg.ranges[i]);
                        if (i < msg.num_ranges-1)
                            Console.Write(", ");
                    }
                    Console.WriteLine(" ]");
                    Console.WriteLine("  name         = '" + msg.name + "'");
                    Console.WriteLine("  enabled      = '" + msg.enabled + "'");
                }
            }
示例#2
0
        public static void Main(string[] args)
        {
            try
            {
                LCM.LCM myLCM = LCM.LCM.Singleton;

                exlcm.example_t msg  = new exlcm.example_t();
                TimeSpan        span = DateTime.Now - new DateTime(1970, 1, 1);
                msg.timestamp   = span.Ticks * 100;
                msg.position    = new double[] { 1, 2, 3 };
                msg.orientation = new double[] { 1, 0, 0, 0 };
                msg.num_ranges  = 15;
                msg.ranges      = new short[msg.num_ranges];
                for (int i = 0; i < msg.num_ranges; i++)
                {
                    msg.ranges[i] = (short)i;
                }
                msg.name    = "example string";
                msg.enabled = true;

                myLCM.Publish("EXAMPLE", msg);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Ex: " + ex);
            }
        }
示例#3
0
            public void MessageReceived(LCM.LCM lcm, string channel, LCM.LCMDataInputStream dins)
            {
                Console.WriteLine("RECV: " + channel);

                if (channel == "EXAMPLE")
                {
                    exlcm.example_t msg = new exlcm.example_t(dins);

                    Console.WriteLine("Received message of the type example_t:");
                    Console.WriteLine("  timestamp   = {0:D}", msg.timestamp);
                    Console.WriteLine("  position    = ({0:N}, {1:N}, {2:N})",
                                      msg.position[0], msg.position[1], msg.position[2]);
                    Console.WriteLine("  orientation = ({0:N}, {1:N}, {2:N}, {3:N})",
                                      msg.orientation[0], msg.orientation[1], msg.orientation[2],
                                      msg.orientation[3]);
                    Console.Write("  ranges      = [ ");
                    for (int i = 0; i < msg.num_ranges; i++)
                    {
                        Console.Write(" {0:D}", msg.ranges[i]);
                        if (i < msg.num_ranges - 1)
                        {
                            Console.Write(", ");
                        }
                    }
                    Console.WriteLine(" ]");
                    Console.WriteLine("  name         = '" + msg.name + "'");
                    Console.WriteLine("  enabled      = '" + msg.enabled + "'");
                }
            }
示例#4
0
        public static void Main(string[] args)
        {
            try
            {
                LCM.LCM myLCM = LCM.LCM.Singleton;

                exlcm.example_t msg = new exlcm.example_t();
                TimeSpan span = DateTime.Now - new DateTime(1970, 1, 1);
                msg.timestamp = span.Ticks * 100;
                msg.position = new double[] { 1, 2, 3 };
                msg.orientation = new double[] { 1, 0, 0, 0 };
                msg.num_ranges = 15;
                msg.ranges = new short[msg.num_ranges];
                for (int i = 0; i < msg.num_ranges; i++)
                {
                    msg.ranges[i] = (short) i;
                }
                msg.name = "example string";
                msg.enabled = true;

                myLCM.Publish("EXAMPLE", msg);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Ex: " + ex);
            }
        }
示例#5
0
        public exlcm.example_t Copy()
        {
            exlcm.example_t outobj = new exlcm.example_t();
            outobj.timestamp = this.timestamp;

            outobj.position = new double[(int)3];
            for (int a = 0; a < 3; a++)
            {
                outobj.position[a] = this.position[a];
            }

            outobj.orientation = new double[(int)4];
            for (int a = 0; a < 4; a++)
            {
                outobj.orientation[a] = this.orientation[a];
            }

            outobj.num_ranges = this.num_ranges;

            outobj.ranges = new short[(int)num_ranges];
            for (int a = 0; a < this.num_ranges; a++)
            {
                outobj.ranges[a] = this.ranges[a];
            }

            outobj.name = this.name;

            outobj.enabled = this.enabled;

            return(outobj);
        }
示例#6
0
 public static exlcm.example_t _decodeRecursiveFactory(LCMDataInputStream ins)
 {
     exlcm.example_t o = new exlcm.example_t();
     o._decodeRecursive(ins);
     return o;
 }
示例#7
0
        public exlcm.example_t Copy()
        {
            exlcm.example_t outobj = new exlcm.example_t();
            outobj.timestamp = this.timestamp;
 
            outobj.position = new double[(int) 3];
            for (int a = 0; a < 3; a++) {
                outobj.position[a] = this.position[a];
            }
 
            outobj.orientation = new double[(int) 4];
            for (int a = 0; a < 4; a++) {
                outobj.orientation[a] = this.orientation[a];
            }
 
            outobj.num_ranges = this.num_ranges;
 
            outobj.ranges = new short[(int) num_ranges];
            for (int a = 0; a < this.num_ranges; a++) {
                outobj.ranges[a] = this.ranges[a];
            }
 
            outobj.name = this.name;
 
            outobj.enabled = this.enabled;
 
            return outobj;
        }
示例#8
0
 public static exlcm.example_t _decodeRecursiveFactory(LCMDataInputStream ins)
 {
     exlcm.example_t o = new exlcm.example_t();
     o._decodeRecursive(ins);
     return(o);
 }