ocra-wbi-plugins
Doxygen documentation for the ocra-wbi-plugins repository
ocra-wbi-plugins/ocra-icub/include/ocra-icub/OcraWbiConversions.h
Go to the documentation of this file.
00001 
00009 /*
00010  *  This file is part of ocra-icub.
00011  *  Copyright (C) 2016 Institut des Systèmes Intelligents et de Robotique (ISIR)
00012  *
00013  *  This program is free software: you can redistribute it and/or modify
00014  *  it under the terms of the GNU General Public License as published by
00015  *  the Free Software Foundation, either version 3 of the License, or
00016  *  (at your option) any later version.
00017  *
00018  *  This program is distributed in the hope that it will be useful,
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *  GNU General Public License for more details.
00022  *
00023  *  You should have received a copy of the GNU General Public License
00024  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025 */
00026 
00027 #ifndef OCRA_WBI_CONVERSIONS_H__
00028 #define OCRA_WBI_CONVERSIONS_H__
00029 
00030 #include <iostream>
00031 #include <map>
00032 #include <vector>
00033 
00034 #include <yarp/sig/Vector.h>
00035 #include <yarp/os/Log.h>
00036 #include <wbi/wbi.h>
00037 #include <yarpWholeBodyInterface/yarpWholeBodyInterface.h>
00038 
00039 #include "ocra-icub/Utilities.h"
00040 
00041 namespace ocra_icub
00042 {
00043 
00044 
00045 typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> MatrixXdRm;
00046 
00047 /* Conversions between types/conventions used in Eigen and WBI */
00048 class OcraWbiConversions
00049 {
00050 // CLASS_POINTER_TYPEDEFS(OcraWbiConversions)
00051 public:
00052     static bool eigenDispdToWbiFrame(const Eigen::Displacementd &disp, wbi::Frame &frame);
00053     static bool wbiFrameToEigenDispd(const wbi::Frame &frame, Eigen::Displacementd &disp);
00054     static bool wbiToOcraTwistVector(Eigen::Twistd &t_wbi, Eigen::Twistd &t_ocra);
00055     static bool ocraToWbiTwistVector(Eigen::Twistd &t_ocra, Eigen::Twistd &t_wbi);
00056     static bool wbiToOcraSegJacobian(const Eigen::MatrixXd &jac, Eigen::MatrixXd &J);
00057     static bool wbiToOcraCoMJacobian(const Eigen::MatrixXd &jac, Eigen::Matrix<double,3,Eigen::Dynamic> &J);
00058     static bool eigenRowMajorToColMajor(const MatrixXdRm &M_rm, Eigen::MatrixXd &M);
00059     static bool wbiToOcraMassMatrix(int qdof, const Eigen::MatrixXd &M_wbi, Eigen::MatrixXd &M_ocra);
00060     static bool wbiToOcraBodyVector(int qdof, const Eigen::VectorXd &v_wbi, Eigen::VectorXd &v_ocra);
00061     static bool eigenToYarpVector(const Eigen::VectorXd &eigenVector, yarp::sig::Vector &yarpVector);
00062     static const int DIM_TRANSLATION = 3;
00063     static const int DIM_ROTATION = 3;
00064 };
00065 } /* ocra_icub */
00066 #endif //OCRA_WBI_CONVERSIONS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines