alloc_accel.cc
Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2011 Austin Robot Technology
00003  *  License: Modified BSD Software License Agreement
00004  * 
00005  *  $Id: alloc_accel.cc 1539 2011-05-09 04:09:20Z jack.oquin $
00006  */
00007 
00016 #include "accel.h"
00017 #include "accel_example.h"
00018 #include "accel_plan.h"
00019 #include "accel_speed.h"
00020 
00021 namespace pilot
00022 {
00023 
00024 // also define an empty abstract base class destructor for the linker
00025 AccelBase::~AccelBase() {}
00026 
00032 boost::shared_ptr<AccelBase>
00033   allocAccel(art_pilot::PilotConfig &config)
00034 {
00035   boost::shared_ptr<AccelBase> controller;
00036 
00037   switch(config.acceleration_controller)
00038     {
00039     default:
00040       {
00041         ROS_ERROR_STREAM("Unknown acceleration controller: "
00042                          << config.acceleration_controller
00043                          << " (using AccelExample)");
00044         config.acceleration_controller = art_pilot::Pilot_Accel_Plan;
00045         // no break: fall into next case...
00046       }
00047     case art_pilot::Pilot_Accel_Example:
00048       {
00049         ROS_INFO("using example acceleration controller");
00050         controller.reset(new AccelExample(config));
00051         break;
00052       }
00053     case art_pilot::Pilot_Accel_Plan:
00054       {
00055         ROS_INFO("using planned acceleration controller");
00056         controller.reset(new AccelPlan(config));
00057         break;
00058       }
00059     case art_pilot::Pilot_Speed_Learned:
00060     case art_pilot::Pilot_Speed_Matrix:
00061     case art_pilot::Pilot_Speed_PID:
00062       {
00063         // An older, speed-based controller. It will figure out which.
00064         controller.reset(new AccelSpeed(config));
00065         break;
00066       }
00067     }
00068 
00069   return controller;
00070 }
00071 
00072 }; // namespace pilot


art_pilot
Author(s): Austin Robot Technology, Jack O'Quin
autogenerated on Fri Jan 3 2014 11:09:32