Fawkes API  Fawkes Development Version
fawkes::OpenRaveEnvironment Class Reference

OpenRaveEnvironment class. More...

#include <>>

Public Member Functions

 OpenRaveEnvironment (fawkes::Logger *logger=0)
 Constructor. More...
 
 OpenRaveEnvironment (const OpenRaveEnvironment &src)
 Copy constructor. More...
 
virtual ~OpenRaveEnvironment ()
 Destructor. More...
 
virtual void create ()
 Create and lock the environment. More...
 
virtual void destroy ()
 Destroy the environment. More...
 
virtual void set_name (const char *name)
 Set name of environment. More...
 
virtual void enable_debug (OpenRAVE::DebugLevel level=OpenRAVE::Level_Debug)
 Enable debugging messages of OpenRAVE. More...
 
virtual void disable_debug ()
 Disable debugging messages of OpenRAVE. More...
 
virtual void start_viewer ()
 Starts the qt viewer in a separate thread. More...
 
virtual void load_IK_solver (OpenRaveRobotPtr &robot, OpenRAVE::IkParameterizationType iktype=OpenRAVE::IKP_Transform6D)
 Autogenerate IKfast IK solver for robot. More...
 
virtual void run_planner (OpenRaveRobotPtr &robot, float sampling=0.01f)
 Plan collision-free path for current and target manipulator configuration of a OpenRaveRobot robot. More...
 
virtual void run_graspplanning (const std::string &target_name, OpenRaveRobotPtr &robot, float sampling=0.01f)
 Run graspplanning script for a given target. More...
 
virtual void add_robot (const std::string &filename)
 Add a robot into the scene. More...
 
virtual void add_robot (OpenRAVE::RobotBasePtr robot)
 Add a robot into the scene. More...
 
virtual void add_robot (OpenRaveRobotPtr &robot)
 Add a robot into the scene. More...
 
virtual bool add_object (const std::string &name, const std::string &filename)
 Add an object to the environment. More...
 
virtual bool delete_object (const std::string &name)
 Remove object from environment. More...
 
virtual bool delete_all_objects ()
 Remove all objects from environment. More...
 
virtual bool rename_object (const std::string &name, const std::string &new_name)
 Rename object. More...
 
virtual bool move_object (const std::string &name, float trans_x, float trans_y, float trans_z)
 Move object in the environment. More...
 
virtual bool move_object (const std::string &name, float trans_x, float trans_y, float trans_z, OpenRaveRobotPtr &robot)
 Move object in the environment. More...
 
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. More...
 
virtual bool rotate_object (const std::string &name, float rot_x, float rot_y, float rot_z)
 Rotate object along its axis. More...
 
virtual void clone_objects (OpenRaveEnvironmentPtr &env)
 Clone all non-robot objects from a referenced OpenRaveEnvironment to this one. More...
 
virtual OpenRAVE::EnvironmentBasePtr get_env_ptr () const
 Get EnvironmentBasePtr. More...
 

Detailed Description

OpenRaveEnvironment class.

Class handling interaction with the OpenRAVE::EnvironmentBase class.

This class loads a scene and handles robots/objects etc in it. All calculations in OpenRAVE (IK, planning, etc) are done based on the current scene.

Author
Bahram Maleki-Fard

Definition at line 45 of file environment.h.

Constructor & Destructor Documentation

◆ OpenRaveEnvironment() [1/2]

fawkes::OpenRaveEnvironment::OpenRaveEnvironment ( fawkes::Logger logger = 0)

Constructor.

Parameters
loggerpointer to fawkes logger

Definition at line 77 of file environment.cpp.

References set_name().

◆ OpenRaveEnvironment() [2/2]

fawkes::OpenRaveEnvironment::OpenRaveEnvironment ( const OpenRaveEnvironment src)

Copy constructor.

This also clones the environment in OpenRAVE, including all bodies! BiRRT planner and IKFast module are also created.

Parameters
srcThe OpenRaveEnvironment to clone

Definition at line 90 of file environment.cpp.

References fawkes::Logger::log_debug(), and set_name().

◆ ~OpenRaveEnvironment()

fawkes::OpenRaveEnvironment::~OpenRaveEnvironment ( )
virtual

Destructor.

Definition at line 114 of file environment.cpp.

References destroy().

Member Function Documentation

◆ add_object()

bool fawkes::OpenRaveEnvironment::add_object ( const std::string &  name,
const std::string &  filename 
)
virtual

Add an object to the environment.

Parameters
namename that should be given to that object
filenamepath to xml file of that object (KinBody)
Returns
true if successful

Definition at line 631 of file environment.cpp.

References fawkes::Logger::log_warn().

◆ add_robot() [1/3]

void fawkes::OpenRaveEnvironment::add_robot ( const std::string &  filename)
virtual

Add a robot into the scene.

Parameters
filenamepath to robot's xml file
Returns
1 if succeeded, 0 if not able to load file

Definition at line 232 of file environment.cpp.

References fawkes::Logger::log_debug().

Referenced by add_robot().

◆ add_robot() [2/3]

void fawkes::OpenRaveEnvironment::add_robot ( OpenRAVE::RobotBasePtr  robot)
virtual

Add a robot into the scene.

Parameters
robotRobotBasePtr of robot to add
Returns
1 if succeeded, 0 if not able to add robot

Definition at line 214 of file environment.cpp.

References fawkes::Logger::log_debug().

◆ add_robot() [3/3]

void fawkes::OpenRaveEnvironment::add_robot ( OpenRaveRobotPtr robot)
virtual

Add a robot into the scene.

Parameters
robotpointer to OpenRaveRobot object of robot to add
Returns
1 if succeeded, 0 if not able to add robot

Definition at line 256 of file environment.cpp.

References add_robot().

◆ clone_objects()

void fawkes::OpenRaveEnvironment::clone_objects ( OpenRaveEnvironmentPtr env)
virtual

Clone all non-robot objects from a referenced OpenRaveEnvironment to this one.

The environments should contain the same objects afterwards. Therefore objects in current environment that do not exist in the reference environment are deleted as well.

Parameters
envThe reference environment

Definition at line 819 of file environment.cpp.

◆ create()

void fawkes::OpenRaveEnvironment::create ( )
virtual

Create and lock the environment.

Definition at line 121 of file environment.cpp.

References fawkes::Logger::log_debug(), and set_name().

◆ delete_all_objects()

bool fawkes::OpenRaveEnvironment::delete_all_objects ( )
virtual

Remove all objects from environment.

Returns
true if successful

Definition at line 671 of file environment.cpp.

References fawkes::Logger::log_warn().

◆ delete_object()

bool fawkes::OpenRaveEnvironment::delete_object ( const std::string &  name)
virtual

Remove object from environment.

Parameters
namename of the object
Returns
true if successful

Definition at line 652 of file environment.cpp.

References fawkes::Logger::log_warn().

◆ destroy()

void fawkes::OpenRaveEnvironment::destroy ( )
virtual

Destroy the environment.

Definition at line 148 of file environment.cpp.

References fawkes::Logger::log_debug(), and fawkes::Logger::log_warn().

Referenced by ~OpenRaveEnvironment().

◆ disable_debug()

void fawkes::OpenRaveEnvironment::disable_debug ( )
virtual

Disable debugging messages of OpenRAVE.

Definition at line 204 of file environment.cpp.

◆ enable_debug()

void fawkes::OpenRaveEnvironment::enable_debug ( OpenRAVE::DebugLevel  level = OpenRAVE::Level_Debug)
virtual

Enable debugging messages of OpenRAVE.

Parameters
leveldebug level to set for OpenRAVE

Definition at line 197 of file environment.cpp.

◆ get_env_ptr()

OpenRAVE::EnvironmentBasePtr fawkes::OpenRaveEnvironment::get_env_ptr ( ) const
virtual

Get EnvironmentBasePtr.

Returns
EnvironmentBasePtr in use

Definition at line 266 of file environment.cpp.

◆ load_IK_solver()

void fawkes::OpenRaveEnvironment::load_IK_solver ( OpenRaveRobotPtr robot,
OpenRAVE::IkParameterizationType  iktype = OpenRAVE::IKP_Transform6D 
)
virtual

Autogenerate IKfast IK solver for robot.

Parameters
robotpointer to OpenRaveRobot object
iktypeIK type of solver (default: Transform6D; use TranslationDirection5D for 5DOF arms)

Definition at line 307 of file environment.cpp.

◆ move_object() [1/2]

bool fawkes::OpenRaveEnvironment::move_object ( const std::string &  name,
float  trans_x,
float  trans_y,
float  trans_z 
)
virtual

Move object in the environment.

Distances are given in meters

Parameters
namename of the object
trans_xtransition along x-axis
trans_ytransition along y-axis
trans_ztransition along z-axis
Returns
true if successful

Definition at line 721 of file environment.cpp.

References fawkes::Logger::log_warn().

Referenced by move_object().

◆ move_object() [2/2]

bool fawkes::OpenRaveEnvironment::move_object ( const std::string &  name,
float  trans_x,
float  trans_y,
float  trans_z,
OpenRaveRobotPtr robot 
)
virtual

Move object in the environment.

Distances are given in meters

Parameters
namename of the object
trans_xtransition along x-axis
trans_ytransition along y-axis
trans_ztransition along z-axis
robotmove relatively to robot (in most simple cases robot is at position (0,0,0) anyway, so this has no effect)
Returns
true if successful

Definition at line 750 of file environment.cpp.

References move_object().

◆ rename_object()

bool fawkes::OpenRaveEnvironment::rename_object ( const std::string &  name,
const std::string &  new_name 
)
virtual

Rename object.

Parameters
namecurrent name of the object
new_namenew name of the object
Returns
true if successful

Definition at line 697 of file environment.cpp.

References fawkes::Logger::log_warn().

◆ rotate_object() [1/2]

bool fawkes::OpenRaveEnvironment::rotate_object ( const std::string &  name,
float  quat_x,
float  quat_y,
float  quat_z,
float  quat_w 
)
virtual

Rotate object by a quaternion.

Parameters
namename of the object
quat_xx value of quaternion
quat_yy value of quaternion
quat_zz value of quaternion
quat_ww value of quaternion
Returns
true if successful

Definition at line 770 of file environment.cpp.

References fawkes::Logger::log_warn().

Referenced by rotate_object().

◆ rotate_object() [2/2]

bool fawkes::OpenRaveEnvironment::rotate_object ( const std::string &  name,
float  rot_x,
float  rot_y,
float  rot_z 
)
virtual

Rotate object along its axis.

Rotation angles should be given in radians.

Parameters
namename of the object
rot_x1st rotation, along x-axis
rot_y2nd rotation, along y-axis
rot_z3rd rotation, along z-axis
Returns
true if successful

Definition at line 800 of file environment.cpp.

References rotate_object().

◆ run_graspplanning()

void fawkes::OpenRaveEnvironment::run_graspplanning ( const std::string &  target_name,
OpenRaveRobotPtr robot,
float  sampling = 0.01f 
)
virtual

Run graspplanning script for a given target.

Script loads grasping databse, checks if target is graspable for various grasps and on success returns a string containing trajectory data. Currently the grasping databse can only be accessed via python, so we use a short python script (shortened and modified from officiel OpenRAVE graspplanning.py) to do the work.

Parameters
target_namename of targeted object (KinBody)
robotpointer to OpenRaveRobot object of robot to use
samplingsampling time between each trajectory point (in seconds)

Definition at line 483 of file environment.cpp.

References fawkes::RefPtr< T_CppObject >::clear(), and fawkes::Logger::log_debug().

◆ run_planner()

void fawkes::OpenRaveEnvironment::run_planner ( OpenRaveRobotPtr robot,
float  sampling = 0.01f 
)
virtual

◆ set_name()

void fawkes::OpenRaveEnvironment::set_name ( const char *  name)
virtual

Set name of environment.

Nothing important, but helpful for debugging etc.

Parameters
nameThe name of the environment. Can be an empty string.

Definition at line 179 of file environment.cpp.

References fawkes::Logger::log_debug().

Referenced by create(), and OpenRaveEnvironment().

◆ start_viewer()

void fawkes::OpenRaveEnvironment::start_viewer ( )
virtual

Starts the qt viewer in a separate thread.

Use this mainly for debugging purposes, as it uses a lot of CPU/GPU resources.

Definition at line 276 of file environment.cpp.

References fawkes::Logger::log_error(), and fawkes::run_viewer().


The documentation for this class was generated from the following files: