Visual Servoing Platform  version 3.6.0 under development (2023-09-27)
vpPioneerPan.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See https://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Common features for Pioneer unicycle mobile robots.
33  *
34 *****************************************************************************/
35 #ifndef VPPIONEERPAN_H
36 #define VPPIONEERPAN_H
37 
38 #include <visp3/core/vpHomogeneousMatrix.h>
39 #include <visp3/core/vpRxyzVector.h>
40 #include <visp3/core/vpTranslationVector.h>
41 #include <visp3/robot/vpUnicycle.h>
42 
94 class VISP_EXPORT vpPioneerPan : public vpUnicycle
95 {
96 public:
100  vpPioneerPan() : mMp_(), pMe_()
101  {
102  double q = 0; // Initial position of the pan axis
103  set_mMp();
104  set_pMe(q);
105  set_cMe();
106  set_eJe(q);
107  }
108 
112  virtual ~vpPioneerPan(){};
113 
116 
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,
151  3); // robot jacobian expressed at the pan head end effector
152 
153  eJe_ = 0;
154  eJe_[0][0] = c1;
155  eJe_[0][1] = -c1 * py - s1 * px;
156 
157  eJe_[2][0] = s1;
158  eJe_[2][1] = -s1 * py + c1 * px;
159 
160  eJe_[4][1] = -1;
161  eJe_[4][2] = 1;
162  }
164 
165 protected:
172  void set_cMe()
173  {
174  // Position of pan head end effector frame in the camera frame
175  double cx = 0;
176  double cy = -0.065; // distance between camera and tilt axis
177  double cz = 0;
178  vpTranslationVector etc(cx, cy, cz);
179  vpRotationMatrix eRc;
180  eRc[0][0] = eRc[1][1] = eRc[2][2] = 0;
181  eRc[0][2] = 1;
182  eRc[1][1] = 1;
183  eRc[2][0] = -1;
184 
186  eMc.buildFrom(etc, eRc);
187 
188  cMe_ = eMc.inverse();
189  }
190 
196  void set_mMp()
197  {
198  // Position of the pan head in the mobile platform frame
199  double px = 0.103; // distance between the pan frame and the robot frame
200  double py = 0;
201  double pz = 0.27;
203  mtp.set(px, py, pz);
204 
205  vpRotationMatrix mRp; // set to Identity
206  mRp[1][1] = mRp[2][2] = -1.;
207 
208  mMp_.insert(mtp);
209  mMp_.insert(mRp);
210  }
211 
219  void set_pMe(const double q)
220  {
221  vpRotationMatrix pRe;
222  pRe[0][0] = cos(q);
223  pRe[0][2] = pRe[1][0] = sin(q);
224  pRe[1][1] = pRe[2][2] = 0.;
225  pRe[2][1] = 1.;
226  pRe[1][2] = -pRe[0][0];
227 
228  pMe_.insert(pRe);
229  }
231 
232 protected:
234  vpHomogeneousMatrix pMe_; // depends on q pan
235 };
236 
237 #endif
void insert(const vpArray2D< Type > &A, unsigned int r, unsigned int c)
Definition: vpArray2D.h:417
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpHomogeneousMatrix inverse() const
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
Generic functions for Pioneer mobile robots equiped with a pan head.
Definition: vpPioneerPan.h:95
void set_eJe(double q_pan)
Definition: vpPioneerPan.h:143
void set_pMe(const double q)
Definition: vpPioneerPan.h:219
void set_mMp()
Definition: vpPioneerPan.h:196
vpHomogeneousMatrix mMp_
Definition: vpPioneerPan.h:233
virtual ~vpPioneerPan()
Definition: vpPioneerPan.h:112
vpHomogeneousMatrix pMe_
Definition: vpPioneerPan.h:234
void set_cMe()
Definition: vpPioneerPan.h:172
Implementation of a rotation matrix and operations on such kind of matrices.
Class that consider the case of a translation vector.
void set(double tx, double ty, double tz)
Generic functions for unicycle mobile robots.
Definition: vpUnicycle.h:54
void set_eJe(const vpMatrix &eJe)
Definition: vpUnicycle.h:120
void set_cMe(const vpHomogeneousMatrix &cMe)
Definition: vpUnicycle.h:110