Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
environment.h
1 
2 /***************************************************************************
3  * environment.h - Fawkes to OpenRAVE Environment
4  *
5  * Created: Sun Sep 19 14:50:34 2010
6  * Copyright 2010 Bahram Maleki-Fard, AllemaniACs RoboCup Team
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __PLUGINS_OPENRAVE_ENVIRONMENT_H_
24 #define __PLUGINS_OPENRAVE_ENVIRONMENT_H_
25 
26 #include <openrave/openrave.h>
27 #include <string>
28 
29 namespace OpenRAVE {
30  class EnvironmentBase;
31  class RobotBase;
32 }
33 
34 namespace fawkes {
35 #if 0 /* just to make Emacs auto-indent happy */
36 }
37 #endif
38 
39 void SetViewer(OpenRAVE::EnvironmentBasePtr penv, const std::string& viewername);
40 
41 class Logger;
42 class OpenRaveRobot;
43 
44 /** OpenRaveEnvironment class */
46 {
47  public:
50 
51  virtual void create();
52  virtual void destroy();
53  virtual void lock();
54 
55  virtual void enable_debug(OpenRAVE::DebugLevel level=OpenRAVE::Level_Debug);
56  virtual void disable_debug();
57 
58  virtual void start_viewer();
59  virtual void load_IK_solver(OpenRaveRobot* robot, OpenRAVE::IkParameterizationType iktype=OpenRAVE::IKP_Transform6D);
60  virtual void run_planner(OpenRaveRobot* robot, float sampling=0.01f);
61  virtual void run_graspplanning(const std::string& target_name, OpenRaveRobot* robot, float sampling=0.01f);
62 
63  virtual void add_robot(const std::string& filename);
64  virtual void add_robot(OpenRAVE::RobotBasePtr robot);
65  virtual void add_robot(OpenRaveRobot* robot);
66 
67  virtual bool add_object(const std::string& name, const std::string& filename);
68  virtual bool delete_object(const std::string& name);
69  virtual bool rename_object(const std::string& name, const std::string& new_name);
70  virtual bool move_object(const std::string& name, float trans_x, float trans_y, float trans_z, OpenRaveRobot* robot=NULL);
71  virtual bool rotate_object(const std::string& name, float quat_x, float quat_y, float quat_z, float quat_w);
72  virtual bool rotate_object(const std::string& name, float rot_x, float rot_y, float rot_z);
73 
74  //virtual RobotBasePtr getRobot() const;
75  virtual OpenRAVE::EnvironmentBasePtr get_env_ptr() const;
76 
77  private:
78  fawkes::Logger* __logger;
79 
80  OpenRAVE::EnvironmentBasePtr __env;
81  OpenRAVE::PlannerBasePtr __planner;
82  OpenRAVE::ModuleBasePtr __mod_ikfast;
83 
84  std::vector<OpenRAVE::GraphHandlePtr> __graph_handle;
85 
86  bool __viewer_enabled;
87 };
88 } // end of namespace fawkes
89 
90 #endif