Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
manipulator.cpp
1 
2 /***************************************************************************
3  * manipulator.cpp - Fawkes to OpenRAVE Manipulator Data
4  *
5  * Created: Thu Sep 16 14:50:34 2010
6  * Copyright 2010 Bahram Maleki-Fard, AllemaniACs RoboCup Team
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 #include "manipulator.h"
24 
25 #include <vector>
26 
27 namespace fawkes {
28 #if 0 /* just to make Emacs auto-indent happy */
29 }
30 #endif
31 
32 /** @class OpenRaveManipulator <plugins/openrave/manipulator.h>
33  * Class containing information about all manipulator motors.
34  * @author Bahram Maleki-Fard
35  */
36 
37 /** Constructor
38  * @param count number of motors of OpenRAVE model
39  * @param count_device number of motors of real device
40  */
41 OpenRaveManipulator::OpenRaveManipulator(unsigned int count, unsigned int count_device) :
42  __cnt( count ),
43  __cnt_device( count_device )
44 {
45 }
46 
47 /** Destructor. */
49 {
50 }
51 
52 
53 /** Adds a motor to the list(vector) of motors
54  * @param number motor number in OpenRAVE
55  * @param number_device motor number of real device
56  */
57 void
58 OpenRaveManipulator::add_motor(unsigned int number, unsigned int number_device)
59 {
60  motor_t motor;
61  motor.no = number;
62  motor.no_device = number_device;
63  motor.angle = 0.f;
64 
65  __motors.push_back(motor);
66 }
67 
68 
69 
70 
71 
72 
73 
74 
75 /* ########## various ########## */
76 /** Transform single OpenRAVE motor angle to real device angle
77  * @param number motor number of real device
78  * @param angle motor angle of OpenRAVE model
79  * @return transformed angle
80  */
81 float
82 OpenRaveManipulator::angle_OR_to_device(unsigned int number, float angle) const
83 {
84  // Transformations should be implemented in subclasses, as these depend on
85  // the attached manipulator device.
86  return angle;
87 }
88 
89 /** Transform single device motor angle to OpenRAVE angle
90  * @param number motor number of real device
91  * @param angle motor angle of real device
92  * @return transformed angle
93  */
94 float
95 OpenRaveManipulator::angle_device_to_OR(unsigned int number, float angle) const
96 {
97  // Transformations should be implemented in subclasses, as these depend on
98  // the attached manipulator device.
99  return angle;
100 }
101 
102 } // end of namespace fawkes