Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * openrave_connector.h - Fawkes OpenRave connector interface 00004 * 00005 * Created: Fri Feb 25 15:08:00 2011 00006 * Copyright 2011 Bahram Maleki-Fard 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. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __PLUGINS_OPENRAVE_ASPECT_OPENRAVE_CONNECTOR_H_ 00025 #define __PLUGINS_OPENRAVE_ASPECT_OPENRAVE_CONNECTOR_H_ 00026 00027 #include <string> 00028 00029 namespace fawkes { 00030 #if 0 /* just to make Emacs auto-indent happy */ 00031 } 00032 #endif 00033 00034 class OpenRaveEnvironment; 00035 class OpenRaveRobot; 00036 class OpenRaveManipulator; 00037 00038 /** @class OpenRaveConnector <plugins/openrave/aspect/openrave_connector.h> 00039 * Interface for a OpenRave connection creator. 00040 * @author Bahram Maleki-Fard 00041 */ 00042 class OpenRaveConnector 00043 { 00044 public: 00045 /** Virtual empty destructor. */ 00046 virtual ~OpenRaveConnector() {} 00047 00048 /** Start OpenRave viewer */ 00049 virtual void start_viewer() const = 0; 00050 00051 /** Run planner on previously set target. 00052 * @param robot robot to use planner on. If none is given, the currently used robot is taken 00053 * @param sampling sampling time between each trajectory point (in seconds) 00054 */ 00055 virtual void run_planner(OpenRaveRobot* robot = NULL, float sampling=0.01f) = 0; 00056 00057 /** Run graspplanning script for a given target. 00058 * @param target_name name of targeted object (KinBody) 00059 * @param robot robot to use planner on. If none is given, the currently used robot is taken 00060 */ 00061 virtual void run_graspplanning(const std::string& target_name, OpenRaveRobot* robot = NULL) = 0; 00062 00063 /** Get pointer to OpenRaveEnvironment object. 00064 * @return pointer 00065 */ 00066 virtual OpenRaveEnvironment* get_environment() const = 0; 00067 00068 /** Get pointer to currently used OpenRaveRobot object. 00069 * @return pointer 00070 */ 00071 virtual OpenRaveRobot* get_active_robot() const = 0; 00072 00073 /** Set robot to be used 00074 * @param robot OpenRaveRobot that should be used implicitly in other methods 00075 */ 00076 virtual void set_active_robot(OpenRaveRobot* robot) = 0; 00077 00078 /** Add a new robot to the environment, and set it as the currently active one. 00079 * @param filename_robot path to robot's xml file 00080 * @param autogenerate_IK if true: autogenerate IKfast IK solver for robot 00081 * @return pointer to new OpenRaveRobot object 00082 */ 00083 virtual OpenRaveRobot* add_robot(const std::string& filename_robot, bool autogenerate_IK) = 0; 00084 00085 /** Set OpenRaveManipulator object for robot, and calculate 00086 * coordinate-system offsets or set them directly. 00087 * Make sure to update manip angles before calibrating! 00088 * @param robot pointer to OpenRaveRobot object, explicitly set 00089 * @param manip pointer to OpenRAVManipulator that is set for robot 00090 * @param trans_x transition offset on x-axis 00091 * @param trans_y transition offset on y-axis 00092 * @param trans_z transition offset on z-axis 00093 * @param calibrate decides whether to calculate offset (true )or set them directly (false; default) 00094 */ 00095 virtual void set_manipulator(OpenRaveRobot* robot, OpenRaveManipulator* manip, float trans_x=0.f, float trans_y=0.f, float trans_z=0.f, bool calibrate=0) = 0; 00096 00097 /** Set OpenRaveManipulator object for robot, and calculate 00098 * coordinate-system offsets or set them directly. 00099 * Make sure to update manip angles before calibrating! 00100 * Uses default OpenRaveRobot object. 00101 * @param manip pointer to OpenRAVManipulator that is set for robot 00102 * @param trans_x transition offset on x-axis 00103 * @param trans_y transition offset on y-axis 00104 * @param trans_z transition offset on z-axis 00105 * @param calibrate decides whether to calculate offset (true )or set them directly (false; default) 00106 */ 00107 virtual void set_manipulator(OpenRaveManipulator* manip, float trans_x=0.f, float trans_y=0.f, float trans_z=0.f, bool calibrate=0) = 0; 00108 00109 // object handling methods 00110 /** Add an object to the environment. 00111 * @param name name that should be given to that object 00112 * @param filename path to xml file of that object (KinBody) 00113 * @return true if successful 00114 */ 00115 virtual bool add_object(const std::string& name, const std::string& filename) = 0; 00116 00117 /** Remove object from environment. 00118 * @param name name of the object 00119 * @return true if successful 00120 */ 00121 virtual bool delete_object(const std::string& name) = 0; 00122 00123 /** Rename object. 00124 * @param name current name of the object 00125 * @param new_name new name of the object 00126 * @return true if successful 00127 */ 00128 virtual bool rename_object(const std::string& name, const std::string& new_name) = 0; 00129 00130 /** Move object in the environment. 00131 * Distances are given in meters 00132 * @param name name of the object 00133 * @param trans_x transition along x-axis 00134 * @param trans_y transition along y-axis 00135 * @param trans_z transition along z-axis 00136 * @param robot if given, move relatively to robot (in most simple cases robot is at position (0,0,0) anyway, so this has no effect) 00137 * @return true if successful 00138 */ 00139 virtual bool move_object(const std::string& name, float trans_x, float trans_y, float trans_z, OpenRaveRobot* robot=NULL) = 0; 00140 00141 /** Rotate object by a quaternion. 00142 * @param name name of the object 00143 * @param quat_x x value of quaternion 00144 * @param quat_y y value of quaternion 00145 * @param quat_z z value of quaternion 00146 * @param quat_w w value of quaternion 00147 * @return true if successful 00148 */ 00149 virtual bool rotate_object(const std::string& name, float quat_x, float quat_y, float quat_z, float quat_w) = 0; 00150 00151 /** Rotate object along its axis. 00152 * Rotation angles should be given in radians. 00153 * @param name name of the object 00154 * @param rot_x 1st rotation, along x-axis 00155 * @param rot_y 2nd rotation, along y-axis 00156 * @param rot_z 3rd rotation, along z-axis 00157 * @return true if successful 00158 */ 00159 virtual bool rotate_object(const std::string& name, float rot_x, float rot_y, float rot_z) = 0; 00160 00161 /** Attach a kinbody to the robot. 00162 * @param name name of the object 00163 * @param robot pointer to OpenRaveRobot that the target is set for 00164 * @return true if successful 00165 */ 00166 virtual bool attach_object(const std::string& name, OpenRaveRobot* robot=NULL) = 0; 00167 00168 /** Release a kinbody from the robot. 00169 * @param name name of the object 00170 * @param robot pointer to OpenRaveRobot that object is released from 00171 * @return true if successful 00172 */ 00173 virtual bool release_object(const std::string& name, OpenRaveRobot* robot=NULL) = 0; 00174 00175 /** Release all grabbed kinbodys from the robot. 00176 * @param robot pointer to OpenRaveRobot that objects are released from 00177 * @return true if successful 00178 */ 00179 virtual bool release_all_objects(OpenRaveRobot* robot) = 0; 00180 00181 /** Set an object as the target. 00182 * Currently the object should be cylindric, and stand upright. It may 00183 * also be rotated on its x-axis, but that rotation needs to be given in an argument 00184 * to calculate correct position for endeffecto. This is only temporary until 00185 * proper graps planning for 5DOF in OpenRave is provided. 00186 * @param name name of the object 00187 * @param robot pointer to OpenRaveRobot that the target is set for 00188 * @param rot_x rotation of object on x-axis (radians) 00189 * @return true if IK solvable 00190 */ 00191 virtual bool set_target_object(const std::string& name, OpenRaveRobot* robot, float rot_x = 0) = 0; 00192 }; 00193 00194 } // end namespace fawkes 00195 00196 #endif