Fawkes API  Fawkes Development Version
fawkes::OpenRaveEnvironment Class Reference

OpenRaveEnvironment class. More...

#include <>>

List of all members.

Public Member Functions

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

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

Constructor & Destructor Documentation

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

Constructor.

Parameters:
loggerpointer to fawkes logger

Definition at line 75 of file environment.cpp.

fawkes::OpenRaveEnvironment::~OpenRaveEnvironment ( )

Destructor.

Definition at line 82 of file environment.cpp.

References destroy().


Member Function Documentation

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 538 of file environment.cpp.

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

Referenced by OpenRaveThread::add_object().

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 167 of file environment.cpp.

References fawkes::Logger::log_debug().

Referenced by add_robot(), and OpenRaveThread::add_robot().

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 150 of file environment.cpp.

References fawkes::Logger::log_debug().

void fawkes::OpenRaveEnvironment::add_robot ( OpenRaveRobot 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 187 of file environment.cpp.

References add_robot(), and fawkes::OpenRaveRobot::get_robot_ptr().

void fawkes::OpenRaveEnvironment::create ( ) [virtual]

Create and lock the environment.

Definition at line 89 of file environment.cpp.

References fawkes::Logger::log_debug().

Referenced by OpenRaveThread::init().

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 559 of file environment.cpp.

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

Referenced by OpenRaveThread::delete_object().

void fawkes::OpenRaveEnvironment::destroy ( ) [virtual]

Destroy the environment.

Definition at line 110 of file environment.cpp.

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

Referenced by ~OpenRaveEnvironment(), and OpenRaveThread::finalize().

void fawkes::OpenRaveEnvironment::disable_debug ( ) [virtual]

Disable debugging messages of OpenRAVE.

Definition at line 140 of file environment.cpp.

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 133 of file environment.cpp.

Referenced by OpenRaveThread::init().

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

Get EnvironmentBasePtr.

Returns:
EnvironmentBasePtr in use

Definition at line 197 of file environment.cpp.

Referenced by OpenRaveThread::set_target_object(), fawkes::OpenRaveRobot::load(), fawkes::OpenRaveRobot::attach_object(), and fawkes::OpenRaveRobot::release_object().

void fawkes::OpenRaveEnvironment::load_IK_solver ( OpenRaveRobot 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 225 of file environment.cpp.

References fawkes::OpenRaveRobot::get_robot_ptr().

Referenced by OpenRaveThread::add_robot().

void fawkes::OpenRaveEnvironment::lock ( ) [virtual]

Lock the environment to prevent changes.

Definition at line 124 of file environment.cpp.

Referenced by run_planner(), add_object(), delete_object(), rename_object(), move_object(), rotate_object(), and OpenRaveThread::init().

bool fawkes::OpenRaveEnvironment::move_object ( const std::string name,
float  trans_x,
float  trans_y,
float  trans_z,
OpenRaveRobot robot = NULL 
) [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
robotif given, move 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 605 of file environment.cpp.

References lock(), fawkes::OpenRaveRobot::get_robot_ptr(), and fawkes::Logger::log_warn().

Referenced by OpenRaveThread::move_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 580 of file environment.cpp.

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

Referenced by OpenRaveThread::rename_object().

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 638 of file environment.cpp.

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

Referenced by rotate_object(), and OpenRaveThread::rotate_object().

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 668 of file environment.cpp.

References rotate_object(), fawkes::Vector::x(), fawkes::Vector::y(), and fawkes::Vector::z().

void fawkes::OpenRaveEnvironment::run_graspplanning ( const std::string target_name,
OpenRaveRobot 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 390 of file environment.cpp.

References fawkes::OpenRaveRobot::get_robot_ptr(), fawkes::Logger::log_debug(), fawkes::OpenRaveRobot::get_trajectory(), fawkes::Vector::x(), and fawkes::OpenRaveRobot::display_planned_movements().

Referenced by OpenRaveThread::run_graspplanning().

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 207 of file environment.cpp.

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

Referenced by OpenRaveThread::start_viewer().


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