Visual Servoing Platform  version 3.0.0
vpPioneerPan.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Common features for Pioneer unicycle mobile robots.
32  *
33  * Authors:
34  * Fabien Spindler
35  *
36  *****************************************************************************/
37 #ifndef VPPIONEERPAN_H
38 #define VPPIONEERPAN_H
39 
40 #include <visp3/core/vpRxyzVector.h>
41 #include <visp3/core/vpTranslationVector.h>
42 #include <visp3/core/vpHomogeneousMatrix.h>
43 #include <visp3/robot/vpUnicycle.h>
44 
45 
95 class VISP_EXPORT vpPioneerPan: public vpUnicycle
96 {
97 public:
101  vpPioneerPan() : mMp_(), pMe_()
102  {
103  double q = 0; // Initial position of the pan axis
104  set_mMp();
105  set_pMe( q );
106  set_cMe();
107  set_eJe( q );
108  }
109 
113  virtual ~vpPioneerPan() {};
114 
140  void set_eJe(double q_pan)
141  {
142  double px = mMp_[0][3];
143  double py = mMp_[1][3];
144  double c1 = cos(q_pan);
145  double s1 = sin(q_pan);
146 
147  eJe_.resize(6,3); // robot jacobian expressed at the pan head end effector
148 
149  eJe_ = 0;
150  eJe_[0][0] = c1;
151  eJe_[0][1] = -c1*py - s1*px;
152 
153  eJe_[2][0] = s1;
154  eJe_[2][1] = -s1*py + c1*px;
155 
156  eJe_[4][1] = -1;
157  eJe_[4][2] = 1;
158  }
159 
160 protected:
164  void set_cMe()
165  {
166  // Position of the camera in the pan frame
167  double cx = 0;
168  double cy = -0.065; // distance between camera and tilt axis
169  double cz = 0;
170  vpTranslationVector etc(cx, cy, cz);
171  vpRotationMatrix eRc;
172  eRc[0][0] = eRc[1][1] = eRc[2][2] = 0;
173  eRc[0][2] = 1;
174  eRc[1][1] = 1;
175  eRc[2][0] = -1;
176 
178  eMc.buildFrom(etc, eRc);
179 
180  cMe_ = eMc.inverse();
181  }
182 
187  void set_mMp()
188  {
189  // Position of the pan head in the mobile platform frame
190  double px = 0.103; // distance between the pan frame and the robot frame
191  double py = 0;
192  double pz = 0.27;
194  mtp.set(px, py, pz);
195 
196  vpRotationMatrix mRp; // set to Identity
197  mRp[1][1] = mRp[2][2] = -1.;
198 
199  mMp_.insert(mtp);
200  mMp_.insert(mRp);
201  }
202 
210  void set_pMe(const double q)
211  {
212  vpRotationMatrix pRe;
213  pRe[0][0] = cos(q);
214  pRe[0][2] = pRe[1][0] = sin(q);
215  pRe[1][1] = pRe[2][2] = 0.;
216  pRe[2][1] = 1.;
217  pRe[1][2] = - pRe[0][0];
218 
219  pMe_.insert(pRe);
220  }
221 
222 protected:
224  vpHomogeneousMatrix pMe_; // depends on q pan
225 
226 };
227 
228 #endif
229 
void set_pMe(const double q)
Definition: vpPioneerPan.h:210
void set_cMe(const vpHomogeneousMatrix &cMe)
Definition: vpUnicycle.h:119
Implementation of an homogeneous matrix and operations on such kind of matrices.
void set_eJe(const vpMatrix &eJe)
Definition: vpUnicycle.h:130
Generic functions for Pioneer mobile robots equiped with a pan head.
Definition: vpPioneerPan.h:95
Implementation of a rotation matrix and operations on such kind of matrices.
Generic functions for unicycle mobile robots.
Definition: vpUnicycle.h:56
vpHomogeneousMatrix mMp_
Definition: vpPioneerPan.h:223
void set_mMp()
Definition: vpPioneerPan.h:187
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
void set_cMe()
Definition: vpPioneerPan.h:164
vpHomogeneousMatrix pMe_
Definition: vpPioneerPan.h:224
vpHomogeneousMatrix inverse() const
virtual ~vpPioneerPan()
Definition: vpPioneerPan.h:113
void set(const double tx, const double ty, const double tz)
void set_eJe(double q_pan)
Definition: vpPioneerPan.h:140
Class that consider the case of a translation vector.