Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
vpPioneerPan.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 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 
117 
143  void set_eJe(double q_pan)
144  {
145  double px = mMp_[0][3];
146  double py = mMp_[1][3];
147  double c1 = cos(q_pan);
148  double s1 = sin(q_pan);
149 
150  eJe_.resize(6,3); // robot jacobian expressed at the pan head end effector
151 
152  eJe_ = 0;
153  eJe_[0][0] = c1;
154  eJe_[0][1] = -c1*py - s1*px;
155 
156  eJe_[2][0] = s1;
157  eJe_[2][1] = -s1*py + c1*px;
158 
159  eJe_[4][1] = -1;
160  eJe_[4][2] = 1;
161  }
163 
164 protected:
170  void set_cMe()
171  {
172  // Position of the camera in the pan frame
173  double cx = 0;
174  double cy = -0.065; // distance between camera and tilt axis
175  double cz = 0;
176  vpTranslationVector etc(cx, cy, cz);
177  vpRotationMatrix eRc;
178  eRc[0][0] = eRc[1][1] = eRc[2][2] = 0;
179  eRc[0][2] = 1;
180  eRc[1][1] = 1;
181  eRc[2][0] = -1;
182 
184  eMc.buildFrom(etc, eRc);
185 
186  cMe_ = eMc.inverse();
187  }
188 
193  void set_mMp()
194  {
195  // Position of the pan head in the mobile platform frame
196  double px = 0.103; // distance between the pan frame and the robot frame
197  double py = 0;
198  double pz = 0.27;
200  mtp.set(px, py, pz);
201 
202  vpRotationMatrix mRp; // set to Identity
203  mRp[1][1] = mRp[2][2] = -1.;
204 
205  mMp_.insert(mtp);
206  mMp_.insert(mRp);
207  }
208 
216  void set_pMe(const double q)
217  {
218  vpRotationMatrix pRe;
219  pRe[0][0] = cos(q);
220  pRe[0][2] = pRe[1][0] = sin(q);
221  pRe[1][1] = pRe[2][2] = 0.;
222  pRe[2][1] = 1.;
223  pRe[1][2] = - pRe[0][0];
224 
225  pMe_.insert(pRe);
226  }
228 
229 protected:
231  vpHomogeneousMatrix pMe_; // depends on q pan
232 
233 };
234 
235 #endif
236 
void set_pMe(const double q)
Definition: vpPioneerPan.h:216
void set_cMe(const vpHomogeneousMatrix &cMe)
Definition: vpUnicycle.h:121
Implementation of an homogeneous matrix and operations on such kind of matrices.
void set_eJe(const vpMatrix &eJe)
Definition: vpUnicycle.h:132
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:230
void set_mMp()
Definition: vpPioneerPan.h:193
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
void set_cMe()
Definition: vpPioneerPan.h:170
vpHomogeneousMatrix pMe_
Definition: vpPioneerPan.h:231
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:143
Class that consider the case of a translation vector.