console_tests.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2009, Willow Garage, Inc.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Neither the name of the Willow Garage, Inc. nor the names of its
00014  *       contributors may be used to endorse or promote products derived from
00015  *       this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  */
00029 
00030 #include <pluginlib/class_list_macros.hpp>
00031 #include <nodelet/nodelet.h>
00032 #include <ros/ros.h>
00033 #include <std_msgs/Float64.h>
00034 #include <stdio.h>
00035 
00036 
00037 #include <math.h> //fabs
00038 
00039 namespace test_nodelet
00040 {
00041 
00042 class ConsoleTest : public nodelet::Nodelet
00043 {
00044 private:
00045   virtual void onInit()
00046   {
00047     std::string suffix("logger_suffix");
00048 
00049     NODELET_DEBUG("DEBUG output");
00050     NODELET_DEBUG_STREAM("DEBUG" << " output");
00051     NODELET_DEBUG_ONCE("DEBUG output");
00052     NODELET_DEBUG_STREAM_ONCE("DEBUG" << " output");
00053     NODELET_DEBUG_COND(1 == 1, "DEBUG output");
00054     NODELET_DEBUG_STREAM_COND(1 == 1, "DEBUG" << " output");
00055     NODELET_DEBUG_COND(1 == 0, "DEBUG output unseen");
00056     NODELET_DEBUG_STREAM_COND(1 == 0, "DEBUG" << " output unseen");
00057     NODELET_DEBUG_THROTTLE(10.0, "DEBUG output");
00058     NODELET_DEBUG_STREAM_THROTTLE(10.0, "DEBUG" << " output");
00059     //TODO TEST FILTERS
00060     //NODELET_DEBUG_FILTER(10.0, "DEBUG output");
00061     //NODELET_DEBUG_STREAM_FILTER(10.0, "DEBUG" << " output");
00062     NODELET_DEBUG_NAMED(suffix, "DEBUG output");
00063     NODELET_DEBUG_STREAM_NAMED(suffix, "DEBUG" << " output");
00064     NODELET_DEBUG_ONCE_NAMED(suffix, "DEBUG output");
00065     NODELET_DEBUG_STREAM_ONCE_NAMED(suffix, "DEBUG" << " output");
00066     NODELET_DEBUG_COND_NAMED(1 == 1, suffix, "DEBUG output");
00067     NODELET_DEBUG_STREAM_COND_NAMED(1 == 1, suffix, "DEBUG" << " output");
00068     NODELET_DEBUG_COND_NAMED(1 == 0, suffix, "DEBUG output unseen");
00069     NODELET_DEBUG_STREAM_COND_NAMED(1 == 0, suffix, "DEBUG" << " output unseen");
00070     NODELET_DEBUG_THROTTLE_NAMED(10.0, suffix, "DEBUG output");
00071     NODELET_DEBUG_STREAM_THROTTLE_NAMED(10.0, suffix, "DEBUG" << " output");
00072     //TODO TEST FILTERS
00073     //NODELET_DEBUG_FILTER_NAMED(10.0, suffix,  "DEBUG output");
00074     //NODELET_DEBUG_STREAM_FILTER_NAMED(10.0, suffix, "DEBUG" << " output");
00075 
00076     NODELET_INFO("INFO output");
00077     NODELET_INFO_STREAM("INFO" << " output");
00078     NODELET_INFO_ONCE("INFO output");
00079     NODELET_INFO_STREAM_ONCE("INFO" << " output");
00080     NODELET_INFO_COND(1 == 1, "INFO output");
00081     NODELET_INFO_STREAM_COND(1 == 1, "INFO" << " output");
00082     NODELET_INFO_COND(1 == 0, "INFO output unseen");
00083     NODELET_INFO_STREAM_COND(1 == 0, "INFO" << " output unseen");
00084     NODELET_INFO_THROTTLE(10.0, "INFO output");
00085     NODELET_INFO_STREAM_THROTTLE(10.0, "INFO" << " output");
00086     //TODO TEST FILTERS
00087     //NODELET_INFO_FILTER(10.0, "INFO output");
00088     //NODELET_INFO_STREAM_FILTER(10.0, "INFO" << " output");
00089     NODELET_INFO_NAMED(suffix, "INFO output");
00090     NODELET_INFO_STREAM_NAMED(suffix, "INFO" << " output");
00091     NODELET_INFO_ONCE_NAMED(suffix, "INFO output");
00092     NODELET_INFO_STREAM_ONCE_NAMED(suffix, "INFO" << " output");
00093     NODELET_INFO_COND_NAMED(1 == 1, suffix, "INFO output");
00094     NODELET_INFO_STREAM_COND_NAMED(1 == 1, suffix, "INFO" << " output");
00095     NODELET_INFO_COND_NAMED(1 == 0, suffix, "INFO output unseen");
00096     NODELET_INFO_STREAM_COND_NAMED(1 == 0, suffix, "INFO" << " output unseen");
00097     NODELET_INFO_THROTTLE_NAMED(10.0, suffix, "INFO output");
00098     NODELET_INFO_STREAM_THROTTLE_NAMED(10.0, suffix, "INFO" << " output");
00099     //TODO TEST FILTERS
00100     //NODELET_INFO_FILTER_NAMED(10.0, suffix,  "INFO output");
00101     //NODELET_INFO_STREAM_FILTER_NAMED(10.0, suffix, "INFO" << " output");
00102 
00103     NODELET_WARN("WARN output");
00104     NODELET_WARN_STREAM("WARN" << " output");
00105     NODELET_WARN_ONCE("WARN output");
00106     NODELET_WARN_STREAM_ONCE("WARN" << " output");
00107     NODELET_WARN_COND(1 == 1, "WARN output");
00108     NODELET_WARN_STREAM_COND(1 == 1, "WARN" << " output");
00109     NODELET_WARN_COND(1 == 0, "WARN output unseen");
00110     NODELET_WARN_STREAM_COND(1 == 0, "WARN" << " output unseen");
00111     NODELET_WARN_THROTTLE(10.0, "WARN output");
00112     NODELET_WARN_STREAM_THROTTLE(10.0, "WARN" << " output");
00113     //TODO TEST FILTERS
00114     //NODELET_WARN_FILTER(10.0, "WARN output");
00115     //NODELET_WARN_STREAM_FILTER(10.0, "WARN" << " output");
00116     NODELET_WARN_NAMED(suffix, "WARN output");
00117     NODELET_WARN_STREAM_NAMED(suffix, "WARN" << " output");
00118     NODELET_WARN_ONCE_NAMED(suffix, "WARN output");
00119     NODELET_WARN_STREAM_ONCE_NAMED(suffix, "WARN" << " output");
00120     NODELET_WARN_COND_NAMED(1 == 1, suffix, "WARN output");
00121     NODELET_WARN_STREAM_COND_NAMED(1 == 1, suffix, "WARN" << " output");
00122     NODELET_WARN_COND_NAMED(1 == 0, suffix, "WARN output unseen");
00123     NODELET_WARN_STREAM_COND_NAMED(1 == 0, suffix, "WARN" << " output unseen");
00124     NODELET_WARN_THROTTLE_NAMED(10.0, suffix, "WARN output");
00125     NODELET_WARN_STREAM_THROTTLE_NAMED(10.0, suffix, "WARN" << " output");
00126     //TODO TEST FILTERS
00127     //NODELET_WARN_FILTER_NAMED(10.0, suffix,  "WARN output");
00128     //NODELET_WARN_STREAM_FILTER_NAMED(10.0, suffix, "WARN" << " output");
00129 
00130     NODELET_ERROR("ERROR output");
00131     NODELET_ERROR_STREAM("ERROR" << " output");
00132     NODELET_ERROR_ONCE("ERROR output");
00133     NODELET_ERROR_STREAM_ONCE("ERROR" << " output");
00134     NODELET_ERROR_COND(1 == 1, "ERROR output");
00135     NODELET_ERROR_STREAM_COND(1 == 1, "ERROR" << " output");
00136     NODELET_ERROR_COND(1 == 0, "ERROR output unseen");
00137     NODELET_ERROR_STREAM_COND(1 == 0, "ERROR" << " output unseen");
00138     NODELET_ERROR_THROTTLE(10.0, "ERROR output");
00139     NODELET_ERROR_STREAM_THROTTLE(10.0, "ERROR" << " output");
00140     //TODO TEST FILTERS
00141     //NODELET_ERROR_FILTER(10.0, "ERROR output");
00142     //NODELET_ERROR_STREAM_FILTER(10.0, "ERROR" << " output");
00143     NODELET_ERROR_NAMED(suffix, "ERROR output");
00144     NODELET_ERROR_STREAM_NAMED(suffix, "ERROR" << " output");
00145     NODELET_ERROR_ONCE_NAMED(suffix, "ERROR output");
00146     NODELET_ERROR_STREAM_ONCE_NAMED(suffix, "ERROR" << " output");
00147     NODELET_ERROR_COND_NAMED(1 == 1, suffix, "ERROR output");
00148     NODELET_ERROR_STREAM_COND_NAMED(1 == 1, suffix, "ERROR" << " output");
00149     NODELET_ERROR_COND_NAMED(1 == 0, suffix, "ERROR output unseen");
00150     NODELET_ERROR_STREAM_COND_NAMED(1 == 0, suffix, "ERROR" << " output unseen");
00151     NODELET_ERROR_THROTTLE_NAMED(10.0, suffix, "ERROR output");
00152     NODELET_ERROR_STREAM_THROTTLE_NAMED(10.0, suffix, "ERROR" << " output");
00153     //TODO TEST FILTERS
00154     //NODELET_ERROR_FILTER_NAMED(10.0, suffix,  "ERROR output");
00155     //NODELET_ERROR_STREAM_FILTER_NAMED(10.0, suffix, "ERROR" << " output");
00156 
00157     NODELET_FATAL("FATAL output");
00158     NODELET_FATAL_STREAM("FATAL" << " output");
00159     NODELET_FATAL_ONCE("FATAL output");
00160     NODELET_FATAL_STREAM_ONCE("FATAL" << " output");
00161     NODELET_FATAL_COND(1 == 1, "FATAL output");
00162     NODELET_FATAL_STREAM_COND(1 == 1, "FATAL" << " output");
00163     NODELET_FATAL_COND(1 == 0, "FATAL output unseen");
00164     NODELET_FATAL_STREAM_COND(1 == 0, "FATAL" << " output unseen");
00165     NODELET_FATAL_THROTTLE(10.0, "FATAL output");
00166     NODELET_FATAL_STREAM_THROTTLE(10.0, "FATAL" << " output");
00167     //TODO TEST FILTERS
00168     //NODELET_FATAL_FILTER(10.0, "FATAL output");
00169     //NODELET_FATAL_STREAM_FILTER(10.0, "FATAL" << " output");
00170     NODELET_FATAL_NAMED(suffix, "FATAL output");
00171     NODELET_FATAL_STREAM_NAMED(suffix, "FATAL" << " named output");
00172     NODELET_FATAL_ONCE_NAMED(suffix, "FATAL named output");
00173     NODELET_FATAL_STREAM_ONCE_NAMED(suffix, "FATAL" << " named output");
00174     NODELET_FATAL_COND_NAMED(1 == 1, suffix, "FATAL named output");
00175     NODELET_FATAL_STREAM_COND_NAMED(1 == 1, suffix, "FATAL" << " named output");
00176     NODELET_FATAL_COND_NAMED(1 == 0, suffix, "FATAL named output unseen");
00177     NODELET_FATAL_STREAM_COND_NAMED(1 == 0, suffix, "FATAL" << " named output unseen");
00178     NODELET_FATAL_THROTTLE_NAMED(10.0, suffix, "FATAL named output");
00179     NODELET_FATAL_STREAM_THROTTLE_NAMED(10.0, suffix, "FATAL" << " named output");
00180     //TODO TEST FILTERS
00181     //NODELET_FATAL_FILTER_NAMED(10.0, suffix,  "FATAL named output");
00182     //NODELET_FATAL_STREAM_FILTER_NAMED(10.0, suffix, "FATAL" << " named output");
00183   }
00184 
00185 };
00186 
00187 PLUGINLIB_EXPORT_CLASS(test_nodelet::ConsoleTest, nodelet::Nodelet)
00188 }


test_nodelet
Author(s): Tully Foote
autogenerated on Sun Feb 17 2019 03:43:56