Fawkes API Fawkes Development Version
openrave_thread.h
1
2/***************************************************************************
3 * openrave_thread.h - OpenRAVE Thread
4 *
5 * Created: Fri Feb 25 15:08:00 2011
6 * Copyright 2011 Bahram Maleki-Fard
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef _PLUGINS_OPENRAVE_OPENRAVE_THREAD_H_
24#define _PLUGINS_OPENRAVE_OPENRAVE_THREAD_H_
25
26#include "types.h"
27
28#include <aspect/aspect_provider.h>
29#include <aspect/blocked_timing.h>
30#include <aspect/configurable.h>
31#include <aspect/logging.h>
32#include <core/threading/thread.h>
33#include <plugins/openrave/aspect/openrave_connector.h>
34#include <plugins/openrave/aspect/openrave_inifin.h>
35
42{
43public:
45 virtual ~OpenRaveThread();
46
47 virtual void init();
48 virtual void loop();
49 virtual void finalize();
50
51 //for OpenRaveConnector
52 //virtual void testDebug();
53 virtual void clone(fawkes::OpenRaveEnvironmentPtr &env,
56
60 virtual void set_active_robot(fawkes::OpenRaveRobot *robot);
61 virtual fawkes::OpenRaveRobotPtr add_robot(const std::string &filename_robot,
62 bool autogenerate_IK);
63
65 float trans_x = 0.f,
66 float trans_y = 0.f,
67 float trans_z = 0.f,
68 bool calibrate = 0);
69 virtual void set_manipulator(fawkes::OpenRaveRobotPtr & robot,
71 float trans_x = 0.f,
72 float trans_y = 0.f,
73 float trans_z = 0.f,
74 bool calibrate = 0);
75
76 virtual void start_viewer() const;
77 virtual void run_planner(fawkes::OpenRaveRobotPtr &robot, float sampling = 0.01f);
78 virtual void run_planner(float sampling = 0.01f);
79 virtual void run_graspplanning(const std::string &target_name, fawkes::OpenRaveRobotPtr &robot);
80 virtual void run_graspplanning(const std::string &target_name);
81
82 //handling objects; mainly from environment.h
83 virtual bool add_object(const std::string &name, const std::string &filename);
84 virtual bool delete_object(const std::string &name);
85 virtual bool delete_all_objects();
86 virtual bool rename_object(const std::string &name, const std::string &new_name);
87 virtual bool move_object(const std::string & name,
88 float trans_x,
89 float trans_y,
90 float trans_z,
92 virtual bool move_object(const std::string &name, float trans_x, float trans_y, float trans_z);
93 virtual bool
94 rotate_object(const std::string &name, float quat_x, float quat_y, float quat_z, float quat_w);
95 virtual bool rotate_object(const std::string &name, float rot_x, float rot_y, float rot_z);
96 virtual bool
97 set_target_object(const std::string &name, fawkes::OpenRaveRobotPtr &robot, float rot_x = 0);
98
99 virtual bool
100 attach_object(const char *name, fawkes::OpenRaveRobotPtr &robot, const char *manip_name = NULL);
101 virtual bool attach_object(const char *name, const char *manip_name = NULL);
102 virtual bool release_object(const std::string &name, fawkes::OpenRaveRobotPtr &robot);
103 virtual bool release_object(const std::string &name);
105 virtual bool release_all_objects();
106
107 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
108protected:
109 virtual void
111 {
112 Thread::run();
113 }
114
115private:
116 fawkes::OpenRaveAspectIniFin or_aspectIniFin_;
117
119 fawkes::OpenRaveRobotPtr OR_robot_;
120};
121
122#endif
OpenRAVE Thread.
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 void run()
Stub to see name in backtrace for easier debugging.
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.
Thread aspect to access configuration data.
Definition: configurable.h:33
Thread aspect to log output.
Definition: logging.h:33
OpenRaveAspect initializer/finalizer.
Interface for a OpenRave connection creator.
OpenRAVE Robot class.
Definition: robot.h:38
RefPtr<> is a reference-counting shared smartpointer.
Definition: refptr.h:50
Thread class encapsulation of pthreads.
Definition: thread.h:46
const char * name() const
Get name of thread.
Definition: thread.h:100