Beispiel #1
0
        private void Callback(Messages.rosgraph_msgs.Log msg)
        {
            string teststring = string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}",
                                              msg.level,
                                              msg.msg,
                                              msg.name,
                                              msg.file,
                                              msg.function, msg.line
                                              );

            bool containesFilteredString  = filter.Count > 0 && filter.Any(teststring.Contains);
            bool isFilteredByVerboseLevel = Math.Pow(2, this.verboseLevel) > msg.level;

            if (containesFilteredString || isFilteredByVerboseLevel)
            {
                return;
            }

            RosoutString rss = new RosoutString(
                (1.0 * msg.header.stamp.data.sec + (1.0 * msg.header.stamp.data.nsec) / 1000000000.0),
                msg.level,
                msg.msg,
                msg.name,
                msg.file,
                msg.function,
                "" + msg.line
                );

            Console.WriteLine(rss.ToString());
        }
Beispiel #2
0
        private void callback(Messages.rosgraph_msgs.Log msg)
        {
            string teststring = string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}", msg.level, msg.msg, msg.name, msg.file, msg.function, msg.line);

            if (ignoredStrings.Count > 0 && ignoredStrings.Any(teststring.Contains))
            {
                return;
            }
            rosoutString rss = new rosoutString((1.0 * msg.header.stamp.data.sec + (1.0 * msg.header.stamp.data.nsec) / 1000000000.0),
                                                msg.level,
                                                msg.msg,
                                                msg.name,
                                                msg.file,
                                                msg.function,
                                                "" + msg.line);

            Dispatcher.Invoke(new Action(() =>
            {
                rosoutdata.Add(rss);

                // remove any messages that are more than a minute NEWER than the JUST RECEIVED log message
                List <rosoutString> tooNew = rosoutdata.Where(s => s.stamp > rss.stamp + 60).ToList();
                if (tooNew.Count > 0)
                {
                    EDB.WriteLine("Dropping " + tooNew.Count + " rosout messages FROM THE FUTURE");
                }
                foreach (rosoutString rs in tooNew)
                {
                    rosoutdata.Remove(rs);
                }

                if (rosoutdata.Count > 1000)
                {
                    rosoutdata.RemoveAt(0);
                }
                abraCadabra.InvalidateMeasure();
                //auto-sticky scrolling IFF the vertical scrollbar is at its maximum or minimum
                if (VisualTreeHelper.GetChildrenCount(abraCadabra) > 0)
                {
                    var border = VisualTreeHelper.GetChild(abraCadabra, 0) as Decorator;
                    if (border != null)
                    {
                        var scroll = border.Child as ScrollViewer;
                        if (scroll != null && !scroll.IsMouseCaptured)
                        {
                            if (scroll.VerticalOffset <= 0 || scroll.VerticalOffset >= scroll.ScrollableHeight - 2)
                            {
                                abraCadabra.ScrollIntoView(rss);
                            }
                        }
                        else
                        {
                            Console.WriteLine("yay");
                        }
                    }
                }
            }));
        }
Beispiel #3
0
        private void callback(Messages.rosgraph_msgs.Log msg)
        {
            string teststring = string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}", msg.level, msg.msg.data, msg.name.data, msg.file.data, msg.function.data, msg.line);

            if (ignoredStrings.Count > 0 && ignoredStrings.Any(teststring.Contains))
            {
                return;
            }
            rosoutString rss = new rosoutString((1.0 * msg.header.stamp.data.sec + (1.0 * msg.header.stamp.data.nsec) / 1000000000.0),
                                                msg.level,
                                                msg.msg.data,
                                                msg.name.data,
                                                msg.file.data,
                                                msg.function.data,
                                                "" + msg.line);

            Dispatcher.Invoke(new Action(() =>
            {
                rosoutdata.Add(rss);
                if (rosoutdata.Count > 1000)
                {
                    rosoutdata.RemoveAt(0);
                }

                //auto-sticky scrolling IFF the vertical scrollbar is at its maximum or minimum
                if (VisualTreeHelper.GetChildrenCount(abraCadabra) > 0)
                {
                    var border = VisualTreeHelper.GetChild(abraCadabra, 0) as Decorator;
                    if (border != null)
                    {
                        var scroll = border.Child as ScrollViewer;
                        if (scroll != null && !scroll.IsMouseCaptured)
                        {
                            if (scroll.VerticalOffset <= 0 || scroll.VerticalOffset >= scroll.ScrollableHeight - 2)
                            {
                                abraCadabra.ScrollIntoView(rss);
                            }
                        }
                        else
                        {
                            Console.WriteLine("yay");
                        }
                    }
                }
            }));
        }
Beispiel #4
0
        private void callback(Messages.rosgraph_msgs.Log msg)
        {
            Dispatcher.Invoke(new Action(() =>
            {
                if (abraCadabra.Visibility != System.Windows.Visibility.Visible)
                {
                    abraCadabra.Visibility = System.Windows.Visibility.Visible;
                }
                string timestamp = DateTime.Now.ToShortTimeString() + "\n";
                string level     = ConvertVerbosityLevel(msg.level) + "\n";
                string msgdata   = msg.msg.data + "\n";
                string msgname   = msg.name.data + "\n";

                rosoutString rss = new rosoutString(timestamp, level, msgdata, msgname);
                rosoutdata.Add(rss);
                abraCadabra.ScrollIntoView(rss);

                //To prevent the list from getting too big, this cuts off old
                cleanList();
            }));
        }