00001 //================================================================================================= 00002 // Copyright (c) 2013, Stefan Kohlbrecher, TU Darmstadt 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 // * Redistributions of source code must retain the above copyright 00008 // notice, this list of conditions and the following disclaimer. 00009 // * Redistributions in binary form must reproduce the above copyright 00010 // notice, this list of conditions and the following disclaimer in the 00011 // documentation and/or other materials provided with the distribution. 00012 // * Neither the name of the Simulation, Systems Optimization and Robotics 00013 // group, TU Darmstadt nor the names of its contributors may be used to 00014 // endorse or promote products derived from this software without 00015 // specific prior written permission. 00016 00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00018 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00019 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00020 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 00021 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00022 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00023 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00024 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00026 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 //================================================================================================= 00028 00029 #ifndef VIGIR_WALK_ANALYZER_H__ 00030 #define VIGIR_WALK_ANALYZER_H__ 00031 00032 #include <stdio.h> 00033 #include <string> 00034 #include <iostream> 00035 #include <fstream> 00036 #include <time.h> 00037 00038 #include <ros/ros.h> 00039 00040 #include <actionlib/action_definition.h> 00041 00042 #include <vigir_footstep_planning_msgs/footstep_planning_msgs.h> 00043 00044 #include <vigir_footstep_planning_lib/math.h> 00045 00046 00047 00048 namespace vigir_footstep_planning 00049 { 00050 class WalkAnalyzer 00051 { 00052 public: 00053 WalkAnalyzer(ros::NodeHandle& nh); 00054 ~WalkAnalyzer(); 00055 00056 void reset(); 00057 00058 void executeStepPlanGoalCallback(const msgs::ExecuteStepPlanActionGoal& execute_goal); 00059 void executeStepPlanResultCallback(const msgs::ExecuteStepPlanActionResult& execute_result); 00060 void stepFeedbackCallback(const msgs::StepPlanFeedback& feedback); 00061 00062 // typedefs 00063 typedef boost::shared_ptr<WalkAnalyzer> Ptr; 00064 typedef boost::shared_ptr<const WalkAnalyzer> ConstPtr; 00065 00066 protected: 00067 virtual bool analyze(const msgs::Step& previous, const msgs::Step& current, const msgs::Step& next, std::string& result) const; 00068 bool analyzeData(const std::map<int, msgs::Step>& data, std::string& result) const; 00069 00070 void writeResult(const std::string& logging_dir, const std::string& data_header); 00071 00072 std::string currentDateTime() const; 00073 00074 std::string logging_dir; 00075 std::string data_header; 00076 00077 actionlib_msgs::GoalID current_goal_id; 00078 00079 msgs::StepPlan current_step_plan; 00080 std::map<int, msgs::Step> step_feedback_map; 00081 }; 00082 } 00083 00084 #endif