00001 #ifndef YOUBOT_FOURSWEDISHWHEELOMNIBASEKINEMATIC_H 00002 #define YOUBOT_FOURSWEDISHWHEELOMNIBASEKINEMATIC_H 00003 00004 /**************************************************************** 00005 * 00006 * Copyright (c) 2011 00007 * All rights reserved. 00008 * 00009 * Hochschule Bonn-Rhein-Sieg 00010 * University of Applied Sciences 00011 * Computer Science Department 00012 * 00013 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00014 * 00015 * Author: 00016 * Jan Paulus, Nico Hochgeschwender, Michael Reckhaus, Azamat Shakhimardanov 00017 * Supervised by: 00018 * Gerhard K. Kraetzschmar 00019 * 00020 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00021 * 00022 * This sofware is published under a dual-license: GNU Lesser General Public 00023 * License LGPL 2.1 and BSD license. The dual-license implies that users of this 00024 * code may choose which terms they prefer. 00025 * 00026 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00027 * 00028 * Redistribution and use in source and binary forms, with or without 00029 * modification, are permitted provided that the following conditions are met: 00030 * 00031 * * Redistributions of source code must retain the above copyright 00032 * notice, this list of conditions and the following disclaimer. 00033 * * Redistributions in binary form must reproduce the above copyright 00034 * notice, this list of conditions and the following disclaimer in the 00035 * documentation and/or other materials provided with the distribution. 00036 * * Neither the name of the Hochschule Bonn-Rhein-Sieg nor the names of its 00037 * contributors may be used to endorse or promote products derived from 00038 * this software without specific prior written permission. 00039 * 00040 * This program is free software: you can redistribute it and/or modify 00041 * it under the terms of the GNU Lesser General Public License LGPL as 00042 * published by the Free Software Foundation, either version 2.1 of the 00043 * License, or (at your option) any later version or the BSD license. 00044 * 00045 * This program is distributed in the hope that it will be useful, 00046 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00047 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00048 * GNU Lesser General Public License LGPL and the BSD license for more details. 00049 * 00050 * You should have received a copy of the GNU Lesser General Public 00051 * License LGPL and BSD license along with this program. 00052 * 00053 ****************************************************************/ 00054 #include <vector> 00055 #include <string> 00056 #include "generic/Logger.hpp" 00057 #include "generic/Units.hpp" 00058 #include "generic/Exceptions.hpp" 00059 #include "base-kinematic/WheeledBaseKinematic.hpp" 00060 #include "base-kinematic/FourSwedishWheelOmniBaseKinematicConfiguration.hpp" 00061 namespace youbot { 00062 00063 /////////////////////////////////////////////////////////////////////////////// 00064 /// Implementation of a base kinematic with four swedish wheels. The youBot base kinematic. 00065 /////////////////////////////////////////////////////////////////////////////// 00066 class FourSwedishWheelOmniBaseKinematic : public WheeledBaseKinematic { 00067 public: 00068 FourSwedishWheelOmniBaseKinematic(); 00069 00070 virtual ~FourSwedishWheelOmniBaseKinematic(); 00071 00072 ///Calculates from the cartesian velocity the individual wheel velocities 00073 ///@param longitudinalVelocity is the forward or backward velocity 00074 ///@param transversalVelocity is the sideway velocity 00075 ///@param angularVelocity is the rotational velocity around the center of the YouBot 00076 ///@param wheelVelocities are the individual wheel velocities 00077 virtual void cartesianVelocityToWheelVelocities(const quantity<si::velocity>& longitudinalVelocity, const quantity<si::velocity>& transversalVelocity, const quantity<si::angular_velocity>& angularVelocity, std::vector<quantity<angular_velocity> >& wheelVelocities); 00078 00079 ///Calculates from the wheel velocities the cartesian velocity 00080 ///@param wheelVelocities are the velocities of the individual wheels 00081 ///@param longitudinalVelocity is the forward or backward velocity 00082 ///@param transversalVelocity is the sideway velocity 00083 ///@param angularVelocity is the rotational velocity around the center of the YouBot 00084 virtual void wheelVelocitiesToCartesianVelocity(const std::vector<quantity<angular_velocity> >& wheelVelocities, quantity<si::velocity>& longitudinalVelocity, quantity<si::velocity>& transversalVelocity, quantity<angular_velocity>& angularVelocity); 00085 00086 ///Calculates from the wheel positions the cartesian position 00087 ///@param wheelPositions are the individual positions of the wheels 00088 ///@param longitudinalPosition is the forward or backward position 00089 ///@param transversalPosition is the sideway position 00090 ///@param orientation is the rotation around the center 00091 virtual void wheelPositionsToCartesianPosition(const std::vector<quantity<plane_angle> >& wheelPositions, quantity<si::length>& longitudinalPosition, quantity<si::length>& transversalPosition, quantity<plane_angle>& orientation); 00092 00093 ///Calculates from the cartesian position the wheel positions 00094 ///@param longitudinalPosition is the forward or backward position 00095 ///@param transversalPosition is the sideway position 00096 ///@param orientation is the rotation around the center 00097 ///@param wheelPositions are the individual positions of the wheels 00098 virtual void cartesianPositionToWheelPositions(const quantity<si::length>& longitudinalPosition, const quantity<si::length>& transversalPosition, const quantity<plane_angle>& orientation, std::vector<quantity<plane_angle> >& wheelPositions); 00099 00100 void setConfiguration(const FourSwedishWheelOmniBaseKinematicConfiguration& configuration); 00101 00102 void getConfiguration(FourSwedishWheelOmniBaseKinematicConfiguration& configuration) const; 00103 00104 00105 private: 00106 FourSwedishWheelOmniBaseKinematicConfiguration config; 00107 00108 std::vector<quantity<plane_angle> > lastWheelPositions; 00109 00110 bool lastWheelPositionInitialized; 00111 00112 quantity<si::length> longitudinalPos; 00113 00114 quantity<si::length> transversalPos; 00115 00116 quantity<plane_angle> angle; 00117 00118 }; 00119 00120 } // namespace youbot 00121 #endif