Fawkes API  Fawkes Development Version
manipulator.cpp
00001 
00002 /***************************************************************************
00003  *  manipulator.cpp - Fawkes to OpenRAVE Manipulator Data
00004  *
00005  *  Created: Thu Sep 16 14:50:34 2010
00006  *  Copyright  2010  Bahram Maleki-Fard, AllemaniACs RoboCup Team
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #include "manipulator.h"
00024 
00025 #include <vector>
00026 
00027 namespace fawkes {
00028 #if 0 /* just to make Emacs auto-indent happy */
00029 }
00030 #endif
00031 
00032 /** @class OpenRaveManipulator <plugins/openrave/manipulator.h>
00033  * Class containing information about all manipulator motors.
00034  * @author Bahram Maleki-Fard
00035  */
00036 
00037 /** Constructor
00038  * @param count number of motors of OpenRAVE model
00039  * @param count_device number of motors of real device
00040  */
00041 OpenRaveManipulator::OpenRaveManipulator(unsigned int count, unsigned int count_device) :
00042   __cnt( count ),
00043   __cnt_device( count_device )
00044 {
00045 }
00046 
00047 /** Destructor. */
00048 OpenRaveManipulator::~OpenRaveManipulator()
00049 {
00050 }
00051 
00052 
00053 /** Adds a motor to the list(vector) of motors
00054  * @param number motor number in OpenRAVE
00055  * @param number_device motor number of real device
00056  */
00057 void
00058 OpenRaveManipulator::add_motor(unsigned int number, unsigned int number_device)
00059 {
00060   motor_t motor;
00061   motor.no = number;
00062   motor.no_device = number_device;
00063   motor.angle = 0.f;
00064 
00065   __motors.push_back(motor);
00066 }
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 /* ########## various ########## */
00076 /** Transform single OpenRAVE motor angle to real device angle
00077  * @param number motor number of real device
00078  * @param angle motor angle of OpenRAVE model
00079  * @return transformed angle
00080  */
00081 float
00082 OpenRaveManipulator::angle_OR_to_device(unsigned int number, float angle) const
00083 {
00084   // Transformations should be implemented in subclasses, as these depend on
00085   // the attached manipulator device.
00086   return angle;
00087 }
00088 
00089 /** Transform single device motor angle to OpenRAVE angle
00090  * @param number motor number of real device
00091  * @param angle motor angle of real device
00092  * @return transformed angle
00093  */
00094 float
00095 OpenRaveManipulator::angle_device_to_OR(unsigned int number, float angle) const
00096 {
00097   // Transformations should be implemented in subclasses, as these depend on
00098   // the attached manipulator device.
00099   return angle;
00100 }
00101 
00102 } // end of namespace fawkes