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
32namespace OpenRAVE {
33class EnvironmentBase;
34class RobotBase;
35} // namespace OpenRAVE
36
37namespace fawkes {
38
39class Logger;
40class OpenRaveRobot;
41
42/** OpenRaveEnvironment class */
44{
45public:
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
89private:
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
Interface for logging.
Definition: logger.h:42
OpenRaveEnvironment class.
Definition: environment.h:44
virtual void create()
Create and lock the environment.
virtual bool move_object(const std::string &name, float trans_x, float trans_y, float trans_z)
Move object in the environment.
virtual void clone_objects(OpenRaveEnvironmentPtr &env)
Clone all non-robot objects from a referenced OpenRaveEnvironment to this one.
virtual void run_graspplanning(const std::string &target_name, OpenRaveRobotPtr &robot, float sampling=0.01f)
Run graspplanning script for a given target.
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.
virtual void add_robot(const std::string &filename)
Add a robot into the scene.
virtual bool delete_all_objects()
Remove all objects from environment.
virtual ~OpenRaveEnvironment()
Destructor.
virtual void load_IK_solver(OpenRaveRobotPtr &robot, OpenRAVE::IkParameterizationType iktype=OpenRAVE::IKP_Transform6D)
Autogenerate IKfast IK solver for robot.
virtual void enable_debug(OpenRAVE::DebugLevel level=OpenRAVE::Level_Debug)
Enable debugging messages of OpenRAVE.
virtual bool delete_object(const std::string &name)
Remove object from environment.
virtual OpenRAVE::EnvironmentBasePtr get_env_ptr() const
Get EnvironmentBasePtr.
virtual void disable_debug()
Disable debugging messages of OpenRAVE.
virtual void run_planner(OpenRaveRobotPtr &robot, float sampling=0.01f)
Plan collision-free path for current and target manipulator configuration of a OpenRaveRobot robot.
virtual void start_viewer()
Starts the qt viewer in a separate thread.
OpenRaveEnvironment(fawkes::Logger *logger=0)
Constructor.
Definition: environment.cpp:71
virtual void set_name(const char *name)
Set name of environment.
virtual bool rename_object(const std::string &name, const std::string &new_name)
Rename object.
virtual void destroy()
Destroy the environment.
virtual bool add_object(const std::string &name, const std::string &filename)
Add an object to the environment.
RefPtr<> is a reference-counting shared smartpointer.
Definition: refptr.h:50
Fawkes library namespace.