Esempio n. 1
0
        public static void Main(string[] args)
        {
            LCM.LCM lcm;

            try
            {
                lcm = new LCM.LCM(new string[] { "tcpq://127.0.0.1:7700" });
                // allow the TCP provider reader to connect to the server before the subscription attempt
                System.Threading.Thread.Sleep(500);
                lcm.SubscribeAll(new SimpleSubscriber());

                while (true)
                {
                    try
                    {
                        System.Threading.Thread.Sleep(1000);

                        Console.WriteLine("SEND: TEST");
                        lcm.Publish("TEST", "foobar");
                    }
                    catch (Exception ex)
                    {
                        Console.Error.WriteLine("Ex: " + ex);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Ex: " + ex);
                Environment.Exit(1);
            }
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            LCM.LCM lcm;

            try
            {
                lcm = new LCM.LCM(new string[] { "tcpq://127.0.0.1:7700" });
                // allow the TCP provider reader to connect to the server before the subscription attempt
                System.Threading.Thread.Sleep(500);
                lcm.SubscribeAll(new SimpleSubscriber());

                while (true)
                {
                    try
                    {
                        System.Threading.Thread.Sleep(1000);

                        Console.WriteLine("SEND: TEST");
                        lcm.Publish("TEST", "foobar");
                    }
                    catch (Exception ex)
                    {
                        Console.Error.WriteLine("Ex: " + ex);
                    }
                }

            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Ex: " + ex);
                Environment.Exit(1);
            }
        }
Esempio n. 3
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);
            }
        }