Fawkes API  Fawkes Development Version
arm.h
1 
2 /***************************************************************************
3  * arm.h - Abstract arm class for a Kinova Jaco arm
4  *
5  * Created: Tue Jul 29 14:58:32 2014
6  * Copyright 2014 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_JACO_ARM_H_
24 #define __PLUGINS_JACO_ARM_H_
25 
26 #include <string>
27 #include <vector>
28 
29 namespace fawkes {
30 #if 0 /* just to make Emacs auto-indent happy */
31 }
32 #endif
33 
34 /** @class JacoArm <plugins/jaco/arm.h>
35  * Abstract class for a Kinova Jaco Arm that we want to control.
36  * @author Bahram Maleki-Fard
37  */
38 class JacoArm
39 {
40  public:
41  /** Virtual empty destructor. */
42  virtual ~JacoArm() {}
43 
44  /** Initialize the arm. */
45  virtual void initialize() = 0;
46 
47 
48 
49  // status checking
50  /** Check if movement is final.
51  * @return is movement final?
52  */
53  virtual bool final() = 0;
54 
55  /** Check if arm is initialized.
56  * @return is arm initialized?
57  */
58  virtual bool initialized() = 0;
59 
60 
61 
62  // getters
63  /** Get the joint angles of the arm
64  * @param to vector to be filled with angle values for active joints.
65  */
66  virtual void get_joints(std::vector<float> &to) const = 0;
67 
68  /** Get the cartesian coordinates of the arm
69  * @param to vector to be filled with coordinates.
70  */
71  virtual void get_coords(std::vector<float> &to) = 0;
72 
73  /** Get the position values of the fingers
74  * @param to vector to be filled with finger positions.
75  */
76  virtual void get_fingers(std::vector<float> &to) const = 0;
77 
78 
79 
80  // commands
81  /** Stop the current movement. */
82  virtual void stop() = 0;
83 
84  /** Simulate a push of a button on the joystick of the Kinova Jaco arm.
85  * @param button the id of the joystick button (from 0 to 15).
86  */
87  virtual void push_joystick(unsigned int button) = 0;
88 
89  /** Simulate releasing the joystick of the Kinova Jaco arm. */
90  virtual void release_joystick() = 0;
91 
92  /** Move the arm along the given trajectory.
93  * @param trajec the trajectory
94  * @param fingers target finger positions
95  */
96  virtual void goto_trajec(std::vector< std::vector<float> >* trajec, std::vector<float> &fingers) = 0;
97 
98  /** Move the arm to given configuration.
99  * @param joints target joint angles
100  * @param fingers target finger positions
101  * @param followup defines if this is a singular trajectory-point, or a consecutive one. Setting to "false"
102  * acuires control of the arm and sets the mode to "angular" each time. Because of that,
103  * it needs to be "true" if it is a "followup" trajectory point.
104  */
105  virtual void goto_joints(std::vector<float> &joints, std::vector<float> &fingers, bool followup=false) = 0;
106 
107  /** Move the arm to given configuration.
108  * @param coords target fingertip coordinations
109  * @param fingers target finger positions
110  */
111  virtual void goto_coords(std::vector<float> &coords, std::vector<float> &fingers) = 0;
112 
113  /** Move the arm to READY position. */
114  virtual void goto_ready() = 0;
115 
116  /** Move the arm to RETRACT position. */
117  virtual void goto_retract() = 0;
118 
119 
120  // non-abstract methods
121  /** Get the name of the arm.
122  * @return the name
123  */
124  std::string get_name() const;
125 
126  protected:
127  std::string __name; /**< the name of this arm */
128  bool __initialized; /**< track if the arm has been initialized or not */
129 };
130 
131 inline
132 std::string
134 {
135  return __name;
136 }
137 
138 } // end of namespace fawkes
139 
140 #endif
Fawkes library namespace.
virtual void goto_retract()=0
Move the arm to RETRACT position.
std::string __name
the name of this arm
Definition: arm.h:127
virtual void get_coords(std::vector< float > &to)=0
Get the cartesian coordinates of the arm.
bool __initialized
track if the arm has been initialized or not
Definition: arm.h:128
virtual void initialize()=0
Initialize the arm.
virtual void release_joystick()=0
Simulate releasing the joystick of the Kinova Jaco arm.
virtual void get_joints(std::vector< float > &to) const =0
Get the joint angles of the arm.
virtual void goto_trajec(std::vector< std::vector< float > > *trajec, std::vector< float > &fingers)=0
Move the arm along the given trajectory.
virtual void goto_ready()=0
Move the arm to READY position.
virtual void goto_joints(std::vector< float > &joints, std::vector< float > &fingers, bool followup=false)=0
Move the arm to given configuration.
virtual void goto_coords(std::vector< float > &coords, std::vector< float > &fingers)=0
Move the arm to given configuration.
virtual ~JacoArm()
Virtual empty destructor.
Definition: arm.h:42
virtual void push_joystick(unsigned int button)=0
Simulate a push of a button on the joystick of the Kinova Jaco arm.
virtual void get_fingers(std::vector< float > &to) const =0
Get the position values of the fingers.
virtual void stop()=0
Stop the current movement.
virtual bool initialized()=0
Check if arm is initialized.
Abstract class for a Kinova Jaco Arm that we want to control.
Definition: arm.h:38
std::string get_name() const
Get the name of the arm.
Definition: arm.h:133