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