23 #include "openrave_thread.h" 25 #include "environment.h" 27 #include "manipulator.h" 29 #include <openrave-core.h> 30 #include <core/exceptions/software.h> 45 :
Thread(
"OpenRaveThread",
Thread::OPMODE_WAITFORWAKEUP),
48 __or_aspectIniFin( this ),
66 OpenRAVE::RaveInitialize(
true);
67 }
catch(
const OpenRAVE::openrave_exception &e) {
137 {robot->
calibrate(trans_x, trans_y, trans_z);}
139 {robot->
set_offset(trans_x, trans_y, trans_z);}
154 set_manipulator(__OR_robot, manip, trans_x, trans_y, trans_z, calibrate);
200 robot->
load(filename_robot, __OR_env);
204 if( autogenerate_IK )
220 return __OR_env->
add_object(name, filename); }
244 return __OR_env->
move_object(name, trans_x, trans_y, trans_z, robot); }
254 return __OR_env->
rotate_object(name, quat_x, quat_y, quat_z, quat_w); }
279 OpenRAVE::Transform transform = __OR_env->
get_env_ptr()->GetKinBody(name)->GetTransform();
293 { robot = __OR_robot; }
307 { robot = __OR_robot; }
320 { robot = __OR_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 start_viewer()
Starts the qt viewer in a separate thread.
OpenRaveThread()
Constructor.
virtual void lock()
Lock the environment to prevent changes.
virtual void set_active_robot(fawkes::OpenRaveRobot *robot)
Set robot to be used.
virtual bool attach_object(const std::string &name, fawkes::OpenRaveRobot *robot=NULL)
Attach a kinbody to the robot.
Fawkes library namespace.
virtual void init()
Initialize the thread.
virtual bool rename_object(const std::string &name, const std::string &new_name)
Rename object.
virtual void set_offset(float trans_x, float trans_y, float trans_z)
Directly set transition offset between coordinate systems of real device and OpenRAVE model...
virtual bool set_target_object(const std::string &name, fawkes::OpenRaveRobot *robot, float rot_x=0)
Set an object as the target.
virtual void run_graspplanning(const std::string &target_name, fawkes::OpenRaveRobot *robot=NULL)
Run graspplanning script for a given target.
virtual OpenRAVE::EnvironmentBasePtr get_env_ptr() const
Get EnvironmentBasePtr.
Thread class encapsulation of pthreads.
virtual bool set_target_object_position(float trans_x, float trans_y, float trans_z, float rot_x)
Set target by giving position of an object.
virtual bool move_object(const std::string &name, float trans_x, float trans_y, float trans_z, fawkes::OpenRaveRobot *robot=NULL)
Move object in the environment.
virtual bool delete_object(const std::string &name)
Remove object from environment.
virtual void finalize()
Finalize the thread.
Logger * logger
This is the Logger member used to access the logger.
virtual ~OpenRaveThread()
Destructor.
virtual void create()
Create and lock the environment.
virtual bool add_object(const std::string &name, const std::string &filename)
Add an object to the environment.
virtual bool attach_object(OpenRAVE::KinBodyPtr object)
Attach a kinbody to the robot.
virtual void load_IK_solver(OpenRaveRobot *robot, OpenRAVE::IkParameterizationType iktype=OpenRAVE::IKP_Transform6D)
Autogenerate IKfast IK solver for robot.
virtual fawkes::OpenRaveEnvironment * get_environment() const
Get pointer to OpenRaveEnvironment object.
virtual void calibrate(float device_trans_x, float device_trans_y, float device_trans_z)
Calculate transition offset between coordinate systems of real device and OpenRAVE model...
Thread aspect to use blocked timing.
virtual bool delete_object(const std::string &name)
Remove object from environment.
virtual fawkes::OpenRaveRobot * add_robot(const std::string &filename_robot, bool autogenerate_IK)
Add a new robot to the environment, and set it as the currently active one.
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.
OpenRaveEnvironment class.
virtual fawkes::OpenRaveRobot * get_active_robot() const
Get pointer to currently used OpenRaveRobot object.
virtual void set_manipulator(fawkes::OpenRaveManipulator *manip, float trans_x=0.f, float trans_y=0.f, float trans_z=0.f, bool calibrate=0)
Set OpenRaveManipulator object for robot, and calculate coordinate-system offsets or set them directl...
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 release_object(const std::string &name, fawkes::OpenRaveRobot *robot=NULL)
Release a kinbody from the robot.
virtual void load(const std::string &filename, fawkes::OpenRaveEnvironment *env)
Load robot from xml file.
Class containing information about all manipulator motors.
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 void log_error(const char *component, const char *format,...)=0
Log error message.
virtual void enable_debug(OpenRAVE::DebugLevel level=OpenRAVE::Level_Debug)
Enable debugging messages of OpenRAVE.
virtual void add_robot(const std::string &filename)
Add a robot into the scene.
const char * name() const
Get name of thread.
Thread aspect provide a new aspect.
virtual void destroy()
Destroy the environment.
virtual bool release_all_objects()
Release all grabbed kinbodys from the robot.
virtual void start_viewer() const
Start Viewer.
virtual void loop()
Code to execute in the thread.
virtual bool rename_object(const std::string &name, const std::string &new_name)
Rename object.
virtual void run_planner(fawkes::OpenRaveRobot *=NULL, float sampling=0.01f)
Run planner on previously set target.
virtual void set_ready()
Set robot ready for usage.
virtual void set_manipulator(fawkes::OpenRaveManipulator *manip, bool display_movements=false)
Set pointer to OpenRaveManipulator object.
virtual bool add_object(const std::string &name, const std::string &filename)
Add an object to the environment.
virtual bool release_all_objects(fawkes::OpenRaveRobot *robot=NULL)
Release all grabbed kinbodys from the robot.
virtual bool release_object(OpenRAVE::KinBodyPtr object)
Release a kinbody from the robot.
virtual void run_graspplanning(const std::string &target_name, OpenRaveRobot *robot, float sampling=0.01f)
Run graspplanning script for a given target.