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 <list>
30 #include <string>
31 #include <vector>
32 
33 class JacoGotoThread;
34 class JacoOpenraveThread;
37 
38 namespace fawkes {
39 
40 class Mutex;
41 class JacoArm;
42 class JacoInterface;
44 
45 /// \brief A trajectory point
46 typedef std::vector<float> jaco_trajec_point_t;
47 /// \brief A trajectory
48 typedef std::vector<jaco_trajec_point_t> jaco_trajec_t;
49 
50 /// \brief The setup-configuration of the arm
51 typedef enum jaco_arm_config_enum {
52  CONFIG_SINGLE, /**< we only have one arm. */
53  CONFIG_LEFT, /**< this arm is the left one out of two. */
54  CONFIG_RIGHT /**< this arm is the right one out of two. */
56 
57 /// \brief The type of a target
58 typedef enum jaco_target_type_enum {
59  TARGET_CARTESIAN, /**< target with cartesian coordinates. */
60  TARGET_ANGULAR, /**< target with angular coordinates. */
61  TARGET_GRIPPER, /**< only gripper movement. */
62  TARGET_READY, /**< target is the READY position of the Jaco arm. */
63  TARGET_RETRACT /**< target is the RETRACT position of the Jaco arm. */
65 
66 /// \brief The state of a trajectory
67 typedef enum jaco_trajec_state_enum {
68  TRAJEC_SKIP, /**< skip trajectory planning for this target. */
69  TRAJEC_WAITING, /**< new trajectory target, wait for planner to process. */
70  TRAJEC_PLANNING, /**< planner is planning the trajectory. */
71  TRAJEC_READY, /**< trajectory has been planned and is ready for execution. */
72  TRAJEC_EXECUTING, /**< trajectory is being executed. */
73  TRAJEC_IK_ERROR, /**< planner could not find IK solution for target */
74  TRAJEC_PLANNING_ERROR /**< planner could not plan a collision-free trajectory. */
76 
77 /// \brief Jaco target struct, holding information on a target.
78 typedef struct jaco_target_struct_t
79 {
80  jaco_target_type_t type; /**< target type. */
81  jaco_trajec_point_t pos; /**< target position (interpreted depending on target type). */
82  jaco_trajec_point_t fingers; /**< target finger values. */
83  fawkes::RefPtr<jaco_trajec_t> trajec; /**< trajectory, if target is TARGET_TRAJEC. */
84  jaco_trajec_state_t trajec_state; /**< state of the trajectory, if target is TARGET_TRAJEC. */
85  bool coord; /**< this target needs to be coordinated with targets of other arms. */
87 
88 /// \brief FIFO target queue, holding RefPtr to targets.
89 typedef std::list<RefPtr<jaco_target_t>> jaco_target_queue_t;
90 
91 /// \brief Jaco struct containing all components required for one arm
92 typedef struct jaco_arm_struct
93 {
94  jaco_arm_config_t config; /**< configuration for this arm */
95  fawkes::JacoArm * arm; /**< pointer to actual JacoArm instance, controlling this arm */
96  JacoInterface * iface; /**< pointer to JacoInterface, assigned to this arm */
97 
98  JacoGotoThread * goto_thread; /**< the GotoThread of this arm. */
99  JacoOpenraveThread *openrave_thread; /**< the OpenraveThread of this arm. */
100 
101  RefPtr<Mutex> target_mutex; /**< mutex, used for accessing the target_queue */
103  trajec_mutex; /**< mutex, used for modifying trajectory of a target. Only locked shortly. */
104 
105  RefPtr<jaco_target_queue_t> target_queue; /**< queue of targets, which is processed FIFO. */
106 
107  float
108  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 {
114  jaco_arm_t * left; /**< the struct with all the data for the left arm. */
115  jaco_arm_t * right; /**< the struct with all the data for the right arm. */
116  JacoBimanualInterface * iface; /**< interface used for coordinated manipulation. */
117  JacoBimanualGotoThread * goto_thread; /**< GotoThread for coordinated manipulation. */
118  JacoBimanualOpenraveThread *openrave_thread; /**< OpenraveThread for coordinated manipulation. */
120 
121 } // end namespace fawkes
122 
123 #endif
fawkes::jaco_arm_struct::goto_thread
JacoGotoThread * goto_thread
the GotoThread of this arm.
Definition: types.h:98
fawkes::TRAJEC_PLANNING_ERROR
@ TRAJEC_PLANNING_ERROR
planner could not plan a collision-free trajectory.
Definition: types.h:74
fawkes::jaco_dual_arm_struct::right
jaco_arm_t * right
the struct with all the data for the right arm.
Definition: types.h:115
fawkes::jaco_arm_t
struct jaco_arm_struct jaco_arm_t
Jaco struct containing all components required for one arm.
Definition: act_thread.h:39
fawkes::jaco_target_struct_t::trajec
fawkes::RefPtr< jaco_trajec_t > trajec
trajectory, if target is TARGET_TRAJEC.
Definition: types.h:83
fawkes::jaco_target_t
struct fawkes::jaco_target_struct_t jaco_target_t
Jaco target struct, holding information on a target.
JacoGotoThread
Definition: goto_thread.h:40
fawkes::RefPtr< jaco_trajec_t >
fawkes::jaco_target_struct_t::type
jaco_target_type_t type
target type.
Definition: types.h:80
fawkes::TRAJEC_EXECUTING
@ TRAJEC_EXECUTING
trajectory is being executed.
Definition: types.h:72
fawkes::CONFIG_SINGLE
@ CONFIG_SINGLE
we only have one arm.
Definition: types.h:52
fawkes::jaco_target_type_t
enum fawkes::jaco_target_type_enum jaco_target_type_t
The type of a target.
fawkes::jaco_dual_arm_t
struct jaco_dual_arm_struct jaco_dual_arm_t
Jaco struct containing all components required for a dual-arm setup.
Definition: bimanual_act_thread.h:39
fawkes::TRAJEC_PLANNING
@ TRAJEC_PLANNING
planner is planning the trajectory.
Definition: types.h:70
fawkes::TARGET_GRIPPER
@ TARGET_GRIPPER
only gripper movement.
Definition: types.h:61
fawkes::JacoBimanualInterface
Definition: JacoBimanualInterface.h:39
fawkes::jaco_arm_struct::trajec_color
float trajec_color[4]
the color used for plotting the trajectory.
Definition: types.h:108
fawkes::CONFIG_RIGHT
@ CONFIG_RIGHT
this arm is the right one out of two.
Definition: types.h:54
fawkes::jaco_arm_struct::iface
JacoInterface * iface
pointer to JacoInterface, assigned to this arm
Definition: types.h:96
fawkes::jaco_trajec_state_t
enum fawkes::jaco_trajec_state_enum jaco_trajec_state_t
The state of a trajectory.
fawkes::TARGET_READY
@ TARGET_READY
target is the READY position of the Jaco arm.
Definition: types.h:62
fawkes::TARGET_ANGULAR
@ TARGET_ANGULAR
target with angular coordinates.
Definition: types.h:60
fawkes::jaco_target_struct_t::pos
jaco_trajec_point_t pos
target position (interpreted depending on target type).
Definition: types.h:81
fawkes::jaco_arm_struct::openrave_thread
JacoOpenraveThread * openrave_thread
the OpenraveThread of this arm.
Definition: types.h:99
fawkes::jaco_target_type_enum
jaco_target_type_enum
The type of a target.
Definition: types.h:58
fawkes::jaco_target_struct_t::trajec_state
jaco_trajec_state_t trajec_state
state of the trajectory, if target is TARGET_TRAJEC.
Definition: types.h:84
fawkes::CONFIG_LEFT
@ CONFIG_LEFT
this arm is the left one out of two.
Definition: types.h:53
fawkes::jaco_dual_arm_struct
Jaco struct containing all components required for a dual-arm setup.
Definition: types.h:112
JacoBimanualGotoThread
Definition: bimanual_goto_thread.h:36
fawkes
fawkes::jaco_arm_struct::arm
fawkes::JacoArm * arm
pointer to actual JacoArm instance, controlling this arm
Definition: types.h:95
fawkes::TRAJEC_SKIP
@ TRAJEC_SKIP
skip trajectory planning for this target.
Definition: types.h:68
fawkes::jaco_target_struct_t
Jaco target struct, holding information on a target.
Definition: types.h:78
fawkes::jaco_arm_struct::target_mutex
RefPtr< Mutex > target_mutex
mutex, used for accessing the target_queue
Definition: types.h:101
fawkes::TARGET_CARTESIAN
@ TARGET_CARTESIAN
target with cartesian coordinates.
Definition: types.h:59
fawkes::TRAJEC_WAITING
@ TRAJEC_WAITING
new trajectory target, wait for planner to process.
Definition: types.h:69
fawkes::jaco_dual_arm_struct::left
jaco_arm_t * left
the struct with all the data for the left arm.
Definition: types.h:114
fawkes::jaco_dual_arm_struct::openrave_thread
JacoBimanualOpenraveThread * openrave_thread
OpenraveThread for coordinated manipulation.
Definition: types.h:118
fawkes::jaco_arm_struct::target_queue
RefPtr< jaco_target_queue_t > target_queue
queue of targets, which is processed FIFO.
Definition: types.h:105
fawkes::jaco_trajec_t
std::vector< jaco_trajec_point_t > jaco_trajec_t
A trajectory.
Definition: types.h:48
JacoOpenraveThread
Definition: openrave_thread.h:36
JacoBimanualOpenraveThread
Definition: bimanual_openrave_thread.h:34
fawkes::jaco_arm_config_t
enum fawkes::jaco_arm_config_enum jaco_arm_config_t
The setup-configuration of the arm.
fawkes::TARGET_RETRACT
@ TARGET_RETRACT
target is the RETRACT position of the Jaco arm.
Definition: types.h:63
fawkes::jaco_arm_struct
Jaco struct containing all components required for one arm.
Definition: types.h:92
fawkes::jaco_trajec_point_t
std::vector< float > jaco_trajec_point_t
A trajectory point.
Definition: types.h:43
fawkes::JacoArm
Definition: arm.h:41
fawkes::jaco_arm_config_enum
jaco_arm_config_enum
The setup-configuration of the arm.
Definition: types.h:51
fawkes::jaco_target_struct_t::coord
bool coord
this target needs to be coordinated with targets of other arms.
Definition: types.h:85
fawkes::jaco_dual_arm_struct::goto_thread
JacoBimanualGotoThread * goto_thread
GotoThread for coordinated manipulation.
Definition: types.h:117
fawkes::TRAJEC_READY
@ TRAJEC_READY
trajectory has been planned and is ready for execution.
Definition: types.h:71
fawkes::jaco_trajec_state_enum
jaco_trajec_state_enum
The state of a trajectory.
Definition: types.h:67
fawkes::jaco_arm_struct::config
jaco_arm_config_t config
configuration for this arm
Definition: types.h:94
fawkes::JacoInterface
Definition: JacoInterface.h:39
fawkes::jaco_target_queue_t
std::list< RefPtr< jaco_target_t > > jaco_target_queue_t
FIFO target queue, holding RefPtr to targets.
Definition: types.h:89
fawkes::jaco_arm_struct::trajec_mutex
RefPtr< Mutex > trajec_mutex
mutex, used for modifying trajectory of a target.
Definition: types.h:103
fawkes::jaco_dual_arm_struct::iface
JacoBimanualInterface * iface
interface used for coordinated manipulation.
Definition: types.h:116
fawkes::jaco_target_struct_t::fingers
jaco_trajec_point_t fingers
target finger values.
Definition: types.h:82
fawkes::TRAJEC_IK_ERROR
@ TRAJEC_IK_ERROR
planner could not find IK solution for target
Definition: types.h:73