Fawkes API  Fawkes Development Version
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 "types.h"
27 
28 #include <openrave/openrave.h>
29 
30 #include <string>
31 
32 namespace OpenRAVE {
33 class EnvironmentBase;
34 class RobotBase;
35 } // namespace OpenRAVE
36 
37 namespace fawkes {
38 
39 class Logger;
40 class OpenRaveRobot;
41 
42 /** OpenRaveEnvironment class */
44 {
45 public:
48  virtual ~OpenRaveEnvironment();
49 
50  virtual void create();
51  virtual void destroy();
52 
53  virtual void set_name(const char *name);
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(OpenRaveRobotPtr & robot,
60  OpenRAVE::IkParameterizationType iktype = OpenRAVE::IKP_Transform6D);
61  virtual void run_planner(OpenRaveRobotPtr &robot, float sampling = 0.01f);
62  virtual void run_graspplanning(const std::string &target_name,
63  OpenRaveRobotPtr & robot,
64  float sampling = 0.01f);
65 
66  virtual void add_robot(const std::string &filename);
67  virtual void add_robot(OpenRAVE::RobotBasePtr robot);
68  virtual void add_robot(OpenRaveRobotPtr &robot);
69 
70  virtual bool add_object(const std::string &name, const std::string &filename);
71  virtual bool delete_object(const std::string &name);
72  virtual bool delete_all_objects();
73  virtual bool rename_object(const std::string &name, const std::string &new_name);
74  virtual bool move_object(const std::string &name, float trans_x, float trans_y, float trans_z);
75  virtual bool move_object(const std::string &name,
76  float trans_x,
77  float trans_y,
78  float trans_z,
79  OpenRaveRobotPtr & robot);
80  virtual bool
81  rotate_object(const std::string &name, float quat_x, float quat_y, float quat_z, float quat_w);
82  virtual bool rotate_object(const std::string &name, float rot_x, float rot_y, float rot_z);
83 
84  virtual void clone_objects(OpenRaveEnvironmentPtr &env);
85 
86  //virtual RobotBasePtr getRobot() const;
87  virtual OpenRAVE::EnvironmentBasePtr get_env_ptr() const;
88 
89 private:
90  fawkes::Logger *logger_;
91 
92  std::string name_;
93  std::string name_str_;
94 
95  OpenRAVE::EnvironmentBasePtr env_;
96  OpenRAVE::PlannerBasePtr planner_;
97  OpenRAVE::ModuleBasePtr mod_ikfast_;
98 
99  boost::thread *viewer_thread_;
100  bool viewer_running_;
101 
102  std::vector<OpenRAVE::GraphHandlePtr> graph_handle_;
103 
104  virtual const char *name() const;
105 };
106 } // end of namespace fawkes
107 
108 #endif
fawkes::OpenRaveEnvironment::get_env_ptr
virtual OpenRAVE::EnvironmentBasePtr get_env_ptr() const
Get EnvironmentBasePtr.
Definition: environment.cpp:260
fawkes::OpenRaveEnvironment::move_object
virtual bool move_object(const std::string &name, float trans_x, float trans_y, float trans_z)
Move object in the environment.
Definition: environment.cpp:735
fawkes::OpenRaveEnvironment::start_viewer
virtual void start_viewer()
Starts the qt viewer in a separate thread.
Definition: environment.cpp:270
fawkes::RefPtr
RefPtr<> is a reference-counting shared smartpointer.
Definition: refptr.h:57
fawkes::OpenRaveEnvironment
OpenRaveEnvironment class.
Definition: environment.h:43
fawkes::OpenRaveEnvironment::delete_object
virtual bool delete_object(const std::string &name)
Remove object from environment.
Definition: environment.cpp:659
fawkes::OpenRaveEnvironment::rotate_object
virtual bool rotate_object(const std::string &name, float quat_x, float quat_y, float quat_z, float quat_w)
Rotate object by a quaternion.
Definition: environment.cpp:791
fawkes::OpenRaveEnvironment::OpenRaveEnvironment
OpenRaveEnvironment(fawkes::Logger *logger=0)
Constructor.
Definition: environment.cpp:71
fawkes::OpenRaveEnvironment::enable_debug
virtual void enable_debug(OpenRAVE::DebugLevel level=OpenRAVE::Level_Debug)
Enable debugging messages of OpenRAVE.
Definition: environment.cpp:188
fawkes::OpenRaveEnvironment::run_graspplanning
virtual void run_graspplanning(const std::string &target_name, OpenRaveRobotPtr &robot, float sampling=0.01f)
Run graspplanning script for a given target.
Definition: environment.cpp:475
fawkes::OpenRaveEnvironment::create
virtual void create()
Create and lock the environment.
Definition: environment.cpp:111
fawkes::OpenRaveEnvironment::~OpenRaveEnvironment
virtual ~OpenRaveEnvironment()
Destructor.
Definition: environment.cpp:104
fawkes::OpenRaveEnvironment::add_object
virtual bool add_object(const std::string &name, const std::string &filename)
Add an object to the environment.
Definition: environment.cpp:638
fawkes::Logger
Definition: logger.h:41
fawkes
fawkes::OpenRaveEnvironment::disable_debug
virtual void disable_debug()
Disable debugging messages of OpenRAVE.
Definition: environment.cpp:195
fawkes::OpenRaveEnvironment::set_name
virtual void set_name(const char *name)
Set name of environment.
Definition: environment.cpp:169
fawkes::OpenRaveEnvironment::add_robot
virtual void add_robot(const std::string &filename)
Add a robot into the scene.
Definition: environment.cpp:226
fawkes::OpenRaveEnvironment::delete_all_objects
virtual bool delete_all_objects()
Remove all objects from environment.
Definition: environment.cpp:681
fawkes::OpenRaveEnvironment::load_IK_solver
virtual void load_IK_solver(OpenRaveRobotPtr &robot, OpenRAVE::IkParameterizationType iktype=OpenRAVE::IKP_Transform6D)
Autogenerate IKfast IK solver for robot.
Definition: environment.cpp:300
fawkes::OpenRaveEnvironment::destroy
virtual void destroy()
Destroy the environment.
Definition: environment.cpp:138
fawkes::OpenRaveEnvironment::rename_object
virtual bool rename_object(const std::string &name, const std::string &new_name)
Rename object.
Definition: environment.cpp:707
fawkes::OpenRaveEnvironment::run_planner
virtual void run_planner(OpenRaveRobotPtr &robot, float sampling=0.01f)
Plan collision-free path for current and target manipulator configuration of a OpenRaveRobot robot.
Definition: environment.cpp:321
fawkes::OpenRaveEnvironment::clone_objects
virtual void clone_objects(OpenRaveEnvironmentPtr &env)
Clone all non-robot objects from a referenced OpenRaveEnvironment to this one.
Definition: environment.cpp:846