Esempio n. 1
0
 public void MessageReceived(LCM.LCM lcm, string channel, LCMDataInputStream ins)
 {
     if (channel == "HALLWAY_TEMPERATURE")
     {
         try
         {
             temperature_t temp = new temperature_t(ins);
             Console.WriteLine("The temperature is: " + temp.deg_celsius);
         }
         catch (System.IO.IOException ex)
         {
             Console.Error.WriteLine("Error decoding temperature message: " + ex);
         }
     }
 }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            LCM.LCM myLCM;

            try
            {
                myLCM = new LCM.LCM();

                myLCM.Subscribe("HALLWAY_TEMPERATURE", new TemperatureDisplay());

                while (true)
                {
                    System.Threading.Thread.Sleep(1000);
                }
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Ex: " + ex);
                Environment.Exit(1);
            }
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            LCM.LCM myLCM = LCM.LCM.Singleton;

            while (true)
            {
                try
                {
                    temperature_t temp = new temperature_t();
                    temp.utime       = DateTime.Now.Ticks / 10;
                    temp.deg_celsius = 25.0 + 5 * Math.Sin(DateTime.Now.Ticks / 10000000.0);

                    myLCM.Publish("HALLWAY_TEMPERATURE", temp);

                    System.Threading.Thread.Sleep(1000);
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Ex: " + ex);
                }
            }
        }