planner_test.cpp
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2018, Locus Robotics
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of the copyright holder nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  */
00034 #include <global_planner_tests/many_map_test_suite.h>
00035 #include <dlux_global_planner/dlux_global_planner.h>
00036 #include <ros/ros.h>
00037 #include <gtest/gtest.h>
00038 #include <string>
00039 
00040 using global_planner_tests::many_map_test_suite;
00041 using dlux_global_planner::DluxGlobalPlanner;
00042 
00043 void dlux_test(std::string ns, std::string potential_calculator = "", std::string traceback = "")
00044 {
00045   TFListenerPtr tf = std::make_shared<tf::TransformListener>(ros::Duration(10));
00046   DluxGlobalPlanner planner;
00047 
00048   ros::NodeHandle nh("~/" + ns);
00049   if (potential_calculator.length() > 0)
00050     nh.setParam("potential_calculator", potential_calculator);
00051   if (traceback.length() > 0)
00052     nh.setParam("traceback", traceback);
00053   EXPECT_TRUE(many_map_test_suite(planner, tf, ns)) << potential_calculator << " " + traceback;
00054 }
00055 
00056 TEST(GlobalPlanner, AStarVon)
00057 {
00058   dlux_test("AStarVon", "dlux_plugins::AStar", "dlux_plugins::VonNeumannPath");
00059 }
00060 
00061 TEST(GlobalPlanner, AStarGrid)
00062 {
00063   dlux_test("AStarGrid", "dlux_plugins::AStar", "dlux_plugins::GridPath");
00064 }
00065 
00066 TEST(GlobalPlanner, AStarGradient)
00067 {
00068   dlux_test("AStarGradient", "dlux_plugins::AStar", "dlux_plugins::GradientPath");
00069 }
00070 
00071 TEST(GlobalPlanner, DijkstraVon)
00072 {
00073   dlux_test("DijkstraVon", "dlux_plugins::Dijkstra", "dlux_plugins::VonNeumannPath");
00074 }
00075 
00076 TEST(GlobalPlanner, DijkstraGrid)
00077 {
00078   dlux_test("DijkstraGrid", "dlux_plugins::Dijkstra", "dlux_plugins::GridPath");
00079 }
00080 
00081 TEST(GlobalPlanner, DijkstraGradient)
00082 {
00083   dlux_test("DijkstraGradient", "dlux_plugins::Dijkstra", "dlux_plugins::GradientPath");
00084 }
00085 
00086 int main(int argc, char **argv)
00087 {
00088   ros::init(argc, argv, "planner_tests");
00089   testing::InitGoogleTest(&argc, argv);
00090   return RUN_ALL_TESTS();
00091 }


dlux_plugins
Author(s):
autogenerated on Wed Jun 26 2019 20:09:55