23#include "openrave_thread.h"
25#include "environment.h"
26#include "manipulator.h"
29#include <core/exceptions/software.h>
31#include <openrave-core.h>
49 or_aspectIniFin_(this),
65 OpenRAVE::RaveInitialize(
true);
66 }
catch (
const OpenRAVE::openrave_exception &e) {
73 OR_env_->enable_debug();
75 OR_env_->set_name(
"viewer");
106 manip = robot->get_manipulator();
108 env->load_IK_solver(robot);
165 robot->set_manipulator(manip);
167 robot->calibrate(trans_x, trans_y, trans_z);
169 robot->set_offset(trans_x, trans_y, trans_z);
189 set_manipulator(OR_robot_, manip, trans_x, trans_y, trans_z, calibrate);
196 OR_env_->start_viewer();
206 OR_env_->run_planner(robot, sampling);
225 OR_env_->run_graspplanning(target_name, robot);
246 robot->load(filename_robot, OR_env_);
247 OR_env_->add_robot(robot);
251 OR_env_->load_IK_solver(robot);
268 return OR_env_->add_object(
name, filename);
277 return OR_env_->delete_object(
name);
285 return OR_env_->delete_all_objects();
295 return OR_env_->rename_object(
name, new_name);
308 return OR_env_->move_object(
name, trans_x, trans_y, trans_z);
326 return OR_env_->move_object(
name, trans_x, trans_y, trans_z, robot);
343 return OR_env_->rotate_object(
name, quat_x, quat_y, quat_z, quat_w);
356 return OR_env_->rotate_object(
name, rot_x, rot_y, rot_z);
372 OpenRAVE::Transform transform = OR_env_->get_env_ptr()->GetKinBody(
name)->GetTransform();
374 return robot->set_target_object_position(transform.trans[0],
389 return robot->attach_object(
name, OR_env_, manip_name);
411 return robot->release_object(
name, OR_env_);
431 return robot->release_all_objects();
virtual void loop()
Code to execute in the thread.
OpenRaveThread()
Constructor.
virtual bool set_target_object(const std::string &name, fawkes::OpenRaveRobotPtr &robot, float rot_x=0)
Set an object as the target.
virtual void start_viewer() const
Start Viewer.
virtual bool add_object(const std::string &name, const std::string &filename)
Add an object to the environment.
virtual void clone(fawkes::OpenRaveEnvironmentPtr &env, fawkes::OpenRaveRobotPtr &robot, fawkes::OpenRaveManipulatorPtr &manip) const
Clone basically everything We pass pointers to pointer as parameters, so the pointers we create befor...
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 void run_graspplanning(const std::string &target_name, fawkes::OpenRaveRobotPtr &robot)
Run graspplanning script for a given target.
virtual bool release_all_objects()
Release all grabbed kinbodys from the robot.
virtual bool attach_object(const char *name, fawkes::OpenRaveRobotPtr &robot, const char *manip_name=NULL)
Attach a kinbody to the robot.
virtual void finalize()
Finalize the thread.
virtual fawkes::OpenRaveRobotPtr 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 rename_object(const std::string &name, const std::string &new_name)
Rename object.
virtual fawkes::OpenRaveEnvironmentPtr get_environment() const
Get pointer to OpenRaveEnvironment object.
virtual bool move_object(const std::string &name, float trans_x, float trans_y, float trans_z, fawkes::OpenRaveRobotPtr &robot)
Move object in the environment, relatively to robot.
virtual bool release_object(const std::string &name, fawkes::OpenRaveRobotPtr &robot)
Release a kinbody from the robot.
virtual bool delete_all_objects()
Remove all objects from environment.
virtual fawkes::OpenRaveRobotPtr get_active_robot() const
Get RefPtr to currently used OpenRaveRobot object.
virtual void run_planner(fawkes::OpenRaveRobotPtr &robot, float sampling=0.01f)
Run planner on previously set target.
virtual void init()
Initialize the thread.
virtual ~OpenRaveThread()
Destructor.
virtual void set_active_robot(fawkes::OpenRaveRobotPtr robot)
Set robot to be used.
virtual bool delete_object(const std::string &name)
Remove object from environment.
virtual void set_manipulator(fawkes::OpenRaveManipulatorPtr &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...
Thread aspect provide a new aspect.
Thread aspect to use blocked timing.
virtual void log_error(const char *component, const char *format,...)=0
Log error message.
Logger * logger
This is the Logger member used to access the logger.
OpenRaveEnvironment class.
RefPtr<> is a reference-counting shared smartpointer.
Thread class encapsulation of pthreads.
const char * name() const
Get name of thread.
Fawkes library namespace.