Fawkes API
Fawkes Development Version
|
OpenRaveEnvironment class. More...
#include <>>
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. |
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.
fawkes::OpenRaveEnvironment::OpenRaveEnvironment | ( | fawkes::Logger * | logger = 0 | ) |
Constructor.
logger | pointer to fawkes logger |
Definition at line 75 of file environment.cpp.
fawkes::OpenRaveEnvironment::~OpenRaveEnvironment | ( | ) |
bool fawkes::OpenRaveEnvironment::add_object | ( | const std::string & | name, |
const std::string & | filename | ||
) | [virtual] |
Add an object to the environment.
name | name that should be given to that object |
filename | path to xml file of that object (KinBody) |
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.
filename | path to robot's xml 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.
robot | RobotBasePtr of robot to add |
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.
robot | pointer to OpenRaveRobot object of robot to add |
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.
name | name of the object |
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.
level | debug 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.
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.
robot | pointer to OpenRaveRobot object |
iktype | IK 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
name | name of the object |
trans_x | transition along x-axis |
trans_y | transition along y-axis |
trans_z | transition along z-axis |
robot | if given, move relatively to robot (in most simple cases robot is at position (0,0,0) anyway, so this has no effect) |
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.
name | current name of the object |
new_name | new name of the object |
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.
name | name of the object |
quat_x | x value of quaternion |
quat_y | y value of quaternion |
quat_z | z value of quaternion |
quat_w | w value of quaternion |
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.
name | name of the object |
rot_x | 1st rotation, along x-axis |
rot_y | 2nd rotation, along y-axis |
rot_z | 3rd rotation, along z-axis |
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.
target_name | name of targeted object (KinBody) |
robot | pointer to OpenRaveRobot object of robot to use |
sampling | sampling 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::run_planner | ( | OpenRaveRobot * | robot, |
float | sampling = 0.01f |
||
) | [virtual] |
Plan collision-free path for current and target manipulator configuration of a OpenRaveRobot robot.
robot | pointer to OpenRaveRobot object of robot to use |
sampling | sampling time between each trajectory point (in seconds) |
Definition at line 243 of file environment.cpp.
References lock(), fawkes::OpenRaveRobot::get_robot_ptr(), fawkes::OpenRaveRobot::get_planner_params(), fawkes::Logger::log_debug(), fawkes::OpenRaveRobot::get_basemanip(), fawkes::OpenRaveRobot::get_target(), fawkes::target_t::type, fawkes::TARGET_RELATIVE_EXT, fawkes::target_t::y, fawkes::target_t::z, fawkes::target_t::x, fawkes::TARGET_RELATIVE, fawkes::TARGET_JOINTS, fawkes::target_t::manip, fawkes::OpenRaveManipulator::get_angles(), fawkes::TARGET_IKPARAM, fawkes::target_t::ikparam, fawkes::TARGET_TRANSFORM, fawkes::target_t::qw, fawkes::target_t::qx, fawkes::target_t::qy, fawkes::target_t::qz, fawkes::target_t::plannerparams, fawkes::OpenRaveRobot::get_trajectory(), fawkes::Vector::x(), and fawkes::OpenRaveRobot::display_planned_movements().
Referenced by OpenRaveThread::run_planner().
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().