Fawkes API  Fawkes Development Version
environment.h
00001 
00002 /***************************************************************************
00003  *  environment.h - Fawkes to OpenRAVE Environment
00004  *
00005  *  Created: Sun Sep 19 14:50:34 2010
00006  *  Copyright  2010  Bahram Maleki-Fard, AllemaniACs RoboCup Team
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __PLUGINS_OPENRAVE_ENVIRONMENT_H_
00024 #define __PLUGINS_OPENRAVE_ENVIRONMENT_H_
00025 
00026 #include <openrave/openrave.h>
00027 #include <string>
00028 
00029 namespace OpenRAVE {
00030   class EnvironmentBase;
00031   class RobotBase;
00032 }
00033 
00034 namespace fawkes {
00035 #if 0 /* just to make Emacs auto-indent happy */
00036 }
00037 #endif
00038 
00039 void SetViewer(OpenRAVE::EnvironmentBasePtr penv, const std::string& viewername);
00040 
00041 class Logger;
00042 class OpenRaveRobot;
00043 
00044 /** OpenRaveEnvironment class */
00045 class OpenRaveEnvironment
00046 {
00047  public:
00048   OpenRaveEnvironment(fawkes::Logger* logger = 0);
00049   ~OpenRaveEnvironment();
00050 
00051   virtual void create();
00052   virtual void destroy();
00053   virtual void lock();
00054 
00055   virtual void enable_debug(OpenRAVE::DebugLevel level=OpenRAVE::Level_Debug);
00056   virtual void disable_debug();
00057 
00058   virtual void start_viewer();
00059   virtual void load_IK_solver(OpenRaveRobot* robot, OpenRAVE::IkParameterizationType iktype=OpenRAVE::IKP_Transform6D);
00060   virtual void run_planner(OpenRaveRobot* robot, float sampling=0.01f);
00061   virtual void run_graspplanning(const std::string& target_name, OpenRaveRobot* robot, float sampling=0.01f);
00062 
00063   virtual void add_robot(const std::string& filename);
00064   virtual void add_robot(OpenRAVE::RobotBasePtr robot);
00065   virtual void add_robot(OpenRaveRobot* robot);
00066 
00067   virtual bool add_object(const std::string& name, const std::string& filename);
00068   virtual bool delete_object(const std::string& name);
00069   virtual bool rename_object(const std::string& name, const std::string& new_name);
00070   virtual bool move_object(const std::string& name, float trans_x, float trans_y, float trans_z, OpenRaveRobot* robot=NULL);
00071   virtual bool rotate_object(const std::string& name, float quat_x, float quat_y, float quat_z, float quat_w);
00072   virtual bool rotate_object(const std::string& name, float rot_x, float rot_y, float rot_z);
00073 
00074   //virtual RobotBasePtr getRobot() const;
00075   virtual OpenRAVE::EnvironmentBasePtr get_env_ptr() const;
00076 
00077  private:
00078   fawkes::Logger*       __logger;
00079 
00080   OpenRAVE::EnvironmentBasePtr  __env;
00081   OpenRAVE::PlannerBasePtr      __planner;
00082   OpenRAVE::ModuleBasePtr       __mod_ikfast;
00083 
00084   std::vector<OpenRAVE::GraphHandlePtr> __graph_handle;
00085 
00086   bool  __viewer_enabled;
00087 };
00088 } // end of namespace fawkes
00089 
00090 #endif