Fawkes API  Fawkes Development Version
types.h
1 
2 /***************************************************************************
3  * types.h - Definition of types for Kinova Jaco Plugin
4  *
5  * Created: Thu Jun 13 19:14:20 2013
6  * Copyright 2013 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. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __PLUGINS_JACO_TYPES_H_
25 #define __PLUGINS_JACO_TYPES_H_
26 
27 #include <core/utils/refptr.h>
28 
29 #include <string>
30 #include <vector>
31 #include <list>
32 
33 class JacoGotoThread;
34 class JacoOpenraveThread;
37 
38 namespace fawkes {
39 #if 0 /* just to make Emacs auto-indent happy */
40 }
41 #endif
42 
43 class Mutex;
44 class JacoArm;
45 class JacoInterface;
47 
48 /// \brief A trajectory point
49 typedef std::vector<float> jaco_trajec_point_t;
50 /// \brief A trajectory
51 typedef std::vector<jaco_trajec_point_t> jaco_trajec_t;
52 
53 /// \brief The setup-configuration of the arm
54 typedef enum jaco_arm_config_enum {
55  CONFIG_SINGLE, /**< we only have one arm. */
56  CONFIG_LEFT, /**< this arm is the left one out of two. */
57  CONFIG_RIGHT /**< this arm is the right one out of two. */
59 
60 /// \brief The type of a target
61 typedef enum jaco_target_type_enum {
62  TARGET_CARTESIAN, /**< target with cartesian coordinates. */
63  TARGET_ANGULAR, /**< target with angular coordinates. */
64  TARGET_GRIPPER, /**< only gripper movement. */
65  TARGET_READY, /**< target is the READY position of the Jaco arm. */
66  TARGET_RETRACT /**< target is the RETRACT position of the Jaco arm. */
68 
69 /// \brief The state of a trajectory
70 typedef enum jaco_trajec_state_enum {
71  TRAJEC_SKIP, /**< skip trajectory planning for this target. */
72  TRAJEC_WAITING, /**< new trajectory target, wait for planner to process. */
73  TRAJEC_PLANNING, /**< planner is planning the trajectory. */
74  TRAJEC_READY, /**< trajectory has been planned and is ready for execution. */
75  TRAJEC_EXECUTING, /**< trajectory is being executed. */
76  TRAJEC_IK_ERROR, /**< planner could not find IK solution for target */
77  TRAJEC_PLANNING_ERROR /**< planner could not plan a collision-free trajectory. */
79 
80 /// \brief Jaco target struct, holding information on a target.
81 typedef struct jaco_target_struct_t {
82  jaco_target_type_t type; /**< target type. */
83  jaco_trajec_point_t pos; /**< target position (interpreted depending on target type). */
84  jaco_trajec_point_t fingers; /**< target finger values. */
85  fawkes::RefPtr<jaco_trajec_t> trajec; /**< trajectory, if target is TARGET_TRAJEC. */
86  jaco_trajec_state_t trajec_state; /**< state of the trajectory, if target is TARGET_TRAJEC. */
87  bool coord; /**< this target needs to be coordinated with targets of other arms. */
89 
90 
91 /// \brief FIFO target queue, holding RefPtr to targets.
92 typedef std::list< RefPtr<jaco_target_t> > jaco_target_queue_t;
93 
94 /// \brief Jaco struct containing all components required for one arm
95 typedef struct jaco_arm_struct {
96  jaco_arm_config_t config; /**< configuration for this arm */
97  fawkes::JacoArm *arm; /**< pointer to actual JacoArm instance, controlling this arm */
98  JacoInterface *iface; /**< pointer to JacoInterface, assigned to this arm */
99 
100  JacoGotoThread *goto_thread; /**< the GotoThread of this arm. */
101  JacoOpenraveThread *openrave_thread; /**< the OpenraveThread of this arm. */
102 
103  RefPtr< Mutex > target_mutex; /**< mutex, used for accessing the target_queue */
104  RefPtr< Mutex > trajec_mutex; /**< mutex, used for modifying trajectory of a target. Only locked shortly. */
105 
106  RefPtr< jaco_target_queue_t > target_queue; /**< queue of targets, which is processed FIFO. */
107 
108  float trajec_color[4]; /**< the color used for plotting the trajectory. RGBA values, each from 0-1. */
109 } jaco_arm_t;
110 
111 /// \brief Jaco struct containing all components required for a dual-arm setup
112 typedef struct jaco_dual_arm_struct {
113  jaco_arm_t *left; /**< the struct with all the data for the left arm. */
114  jaco_arm_t *right; /**< the struct with all the data for the right arm. */
115  JacoBimanualInterface *iface; /**< interface used for coordinated manipulation. */
116  JacoBimanualGotoThread *goto_thread; /**< GotoThread for coordinated manipulation. */
117  JacoBimanualOpenraveThread *openrave_thread; /**< OpenraveThread for coordinated manipulation. */
119 
120 
121 } // end namespace fawkes
122 
123 #endif
trajectory has been planned and is ready for execution.
Definition: types.h:74
JacoGotoThread * goto_thread
the GotoThread of this arm.
Definition: types.h:100
Jaco struct containing all components required for one arm.
Definition: types.h:95
Jaco Arm thread for dual-arm setup, integrating OpenRAVE.
JacoBimanualGotoThread * goto_thread
GotoThread for coordinated manipulation.
Definition: types.h:116
Jaco Arm movement thread.
JacoBimanualInterface * iface
interface used for coordinated manipulation.
Definition: types.h:115
Fawkes library namespace.
enum fawkes::jaco_trajec_state_enum jaco_trajec_state_t
The state of a trajectory.
fawkes::RefPtr< jaco_trajec_t > trajec
trajectory, if target is TARGET_TRAJEC.
Definition: types.h:85
fawkes::JacoArm * arm
pointer to actual JacoArm instance, controlling this arm
Definition: types.h:97
JacoBimanualInterface Fawkes BlackBoard Interface.
jaco_target_type_enum
The type of a target.
Definition: types.h:61
std::list< RefPtr< jaco_target_t > > jaco_target_queue_t
FIFO target queue, holding RefPtr to targets.
Definition: types.h:92
RefPtr< Mutex > trajec_mutex
mutex, used for modifying trajectory of a target.
Definition: types.h:104
trajectory is being executed.
Definition: types.h:75
std::vector< jaco_trajec_point_t > jaco_trajec_t
A trajectory.
Definition: types.h:51
enum fawkes::jaco_target_type_enum jaco_target_type_t
The type of a target.
jaco_trajec_state_enum
The state of a trajectory.
Definition: types.h:70
jaco_target_type_t type
target type.
Definition: types.h:82
planner could not plan a collision-free trajectory.
Definition: types.h:77
jaco_arm_t * left
the struct with all the data for the left arm.
Definition: types.h:113
JacoBimanualOpenraveThread * openrave_thread
OpenraveThread for coordinated manipulation.
Definition: types.h:117
jaco_arm_t * right
the struct with all the data for the right arm.
Definition: types.h:114
jaco_trajec_point_t pos
target position (interpreted depending on target type).
Definition: types.h:83
jaco_trajec_state_t trajec_state
state of the trajectory, if target is TARGET_TRAJEC.
Definition: types.h:86
std::vector< float > jaco_trajec_point_t
A trajectory point.
Definition: types.h:46
only gripper movement.
Definition: types.h:64
this arm is the right one out of two.
Definition: types.h:57
JacoInterface * iface
pointer to JacoInterface, assigned to this arm
Definition: types.h:98
JacoOpenraveThread * openrave_thread
the OpenraveThread of this arm.
Definition: types.h:101
RefPtr< Mutex > target_mutex
mutex, used for accessing the target_queue
Definition: types.h:103
target with cartesian coordinates.
Definition: types.h:62
Jaco target struct, holding information on a target.
Definition: types.h:81
target with angular coordinates.
Definition: types.h:63
jaco_arm_config_t config
configuration for this arm
Definition: types.h:96
planner is planning the trajectory.
Definition: types.h:73
bool coord
this target needs to be coordinated with targets of other arms.
Definition: types.h:87
jaco_arm_config_enum
The setup-configuration of the arm.
Definition: types.h:54
RefPtr< jaco_target_queue_t > target_queue
queue of targets, which is processed FIFO.
Definition: types.h:106
Jaco Arm movement thread.
Definition: goto_thread.h:40
planner could not find IK solution for target
Definition: types.h:76
this arm is the left one out of two.
Definition: types.h:56
JacoInterface Fawkes BlackBoard Interface.
Definition: JacoInterface.h:33
skip trajectory planning for this target.
Definition: types.h:71
new trajectory target, wait for planner to process.
Definition: types.h:72
enum fawkes::jaco_arm_config_enum jaco_arm_config_t
The setup-configuration of the arm.
Jaco Arm thread for single-arm setup, integrating OpenRAVE.
Jaco struct containing all components required for a dual-arm setup.
Definition: types.h:112
target is the RETRACT position of the Jaco arm.
Definition: types.h:66
target is the READY position of the Jaco arm.
Definition: types.h:65
struct fawkes::jaco_target_struct_t jaco_target_t
Jaco target struct, holding information on a target.
jaco_trajec_point_t fingers
target finger values.
Definition: types.h:84
we only have one arm.
Definition: types.h:55
struct jaco_arm_struct jaco_arm_t
Jaco struct containing all components required for one arm.
Definition: act_thread.h:33
struct jaco_dual_arm_struct jaco_dual_arm_t
Jaco struct containing all components required for a dual-arm setup.
Abstract class for a Kinova Jaco Arm that we want to control.
Definition: arm.h:38