orrosplanningmain.cpp
Go to the documentation of this file.
00001 // Software License Agreement (BSD License)
00002 // Copyright (c) 2008, Willow Garage, Inc.
00003 // Redistribution and use in source and binary forms, with or without
00004 // modification, are permitted provided that the following conditions are met:
00005 //   * Redistributions of source code must retain the above copyright notice,
00006 //     this list of conditions and the following disclaimer.
00007 //   * Redistributions in binary form must reproduce the above copyright
00008 //     notice, this list of conditions and the following disclaimer in the
00009 //     documentation and/or other materials provided with the distribution.
00010 //   * The name of the author may not be used to endorse or promote products
00011 //     derived from this software without specific prior written permission.
00012 //
00013 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00014 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00015 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00016 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00017 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00018 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00019 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00020 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00021 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00022 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00023 // POSSIBILITY OF SUCH DAMAGE.
00024 //
00025 // \author Rosen Diankov
00026 #include "plugindefs.h"
00027 
00028 #include "objecttransformsystem.h"
00029 #include "rosbindings.h"
00030 #include "collisionmapsystem.h"
00031 
00032 #include <openrave/plugin.h>
00033 
00034 ControllerBasePtr CreateROSPassiveController(EnvironmentBasePtr penv, std::istream& sinput);
00035 
00036 static list< boost::shared_ptr<void> >* s_listRegisteredReaders = NULL;
00037 InterfaceBasePtr CreateInterfaceValidated(InterfaceType type, const std::string& interfacename, std::istream& sinput, EnvironmentBasePtr penv)
00038 {
00039     if( !s_listRegisteredReaders ) {
00040         s_listRegisteredReaders = new list< boost::shared_ptr<void> >();
00041         s_listRegisteredReaders->push_back(ObjectTransformSystem::RegisterXMLReader(penv));
00042         s_listRegisteredReaders->push_back(CollisionMapSystem::RegisterXMLReader(penv));
00043     }
00044     switch(type) {
00045     case PT_SensorSystem:
00046         if( interfacename == "objecttransform" ) {
00047             boost::shared_ptr<ObjectTransformSystem> psys(new ObjectTransformSystem(penv));
00048             if( !psys->Init(sinput) ) {
00049                 RAVELOG_WARN(str(boost::format("failed to init %s\n")%interfacename));
00050             }
00051             return psys;
00052         }
00053         else if( interfacename == "collisionmap" ) {
00054             boost::shared_ptr<CollisionMapSystem> psys(new CollisionMapSystem(penv));
00055             if( !psys->Init(sinput) ) {
00056                 RAVELOG_WARN(str(boost::format("failed to init %s\n")%interfacename));
00057             }
00058             return psys;
00059         }
00060         break;
00061     case PT_ProblemInstance:
00062         if( interfacename == "rosbindings" ) {
00063             return InterfaceBasePtr(new ROSBindings(penv));
00064         }
00065         break;
00066     case PT_Controller:
00067         if( interfacename == "rospassivecontroller" ) {
00068             return CreateROSPassiveController(penv,sinput);
00069         }
00070         break;
00071     default:
00072         break;
00073     }
00074     return InterfaceBasePtr();
00075 }
00076 
00077 void GetPluginAttributesValidated(PLUGININFO& info)
00078 {
00079     info.interfacenames[OpenRAVE::PT_SensorSystem].push_back("ObjectTransform");
00080     info.interfacenames[OpenRAVE::PT_SensorSystem].push_back("CollisionMap");
00081     info.interfacenames[OpenRAVE::PT_ProblemInstance].push_back("ROSBindings");
00082     info.interfacenames[OpenRAVE::PT_Controller].push_back("ROSPassiveController");
00083 }
00084 
00085 OPENRAVE_PLUGIN_API void DestroyPlugin()
00086 {
00087     delete s_listRegisteredReaders;
00088     s_listRegisteredReaders = NULL;
00089 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


orrosplanning
Author(s): Rosen Diankov (rosen.diankov@gmail.com)
autogenerated on Sat Mar 23 2013 22:32:59