Visual Servoing Platform  version 3.6.1 under development (2024-07-27)
vpPioneerPan.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
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 https://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 #ifndef VPPIONEERPAN_H
34 #define VPPIONEERPAN_H
35 
36 #include <visp3/core/vpConfig.h>
37 #include <visp3/core/vpHomogeneousMatrix.h>
38 #include <visp3/core/vpRxyzVector.h>
39 #include <visp3/core/vpTranslationVector.h>
40 #include <visp3/robot/vpUnicycle.h>
41 
92 class VISP_EXPORT vpPioneerPan : public vpUnicycle
93 {
94 public:
98  vpPioneerPan() : mMp_(), pMe_()
99  {
100  double q = 0; // Initial position of the pan axis
101  set_mMp();
102  set_pMe(q);
103  set_cMe();
104  set_eJe(q);
105  }
106 
109 
135  void set_eJe(double q_pan)
136  {
137  double px = mMp_[0][3];
138  double py = mMp_[1][3];
139  double c1 = cos(q_pan);
140  double s1 = sin(q_pan);
141 
142  eJe_.resize(6,
143  3); // robot jacobian expressed at the pan head end effector
144 
145  eJe_ = 0;
146  eJe_[0][0] = c1;
147  eJe_[0][1] = -c1 * py - s1 * px;
148 
149  eJe_[2][0] = s1;
150  eJe_[2][1] = -s1 * py + c1 * px;
151 
152  eJe_[4][1] = -1;
153  eJe_[4][2] = 1;
154  }
156 
157 protected:
164  void set_cMe()
165  {
166  // Position of pan head end effector frame in the camera 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.build(etc, eRc);
179 
180  cMe_ = eMc.inverse();
181  }
182 
188  void set_mMp()
189  {
190  // Position of the pan head in the mobile platform frame
191  double px = 0.103; // distance between the pan frame and the robot frame
192  double py = 0;
193  double pz = 0.27;
195  mtp.set(px, py, pz);
196 
197  vpRotationMatrix mRp; // set to Identity
198  mRp[1][1] = mRp[2][2] = -1.;
199 
200  mMp_.insert(mtp);
201  mMp_.insert(mRp);
202  }
203 
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  }
222 
223 protected:
225  vpHomogeneousMatrix pMe_; // depends on q pan
226 };
227 END_VISP_NAMESPACE
228 #endif
void insert(const vpArray2D< Type > &A, unsigned int r, unsigned int c)
Definition: vpArray2D.h:494
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpHomogeneousMatrix & build(const vpTranslationVector &t, const vpRotationMatrix &R)
vpHomogeneousMatrix inverse() const
Generic functions for Pioneer mobile robots equipped with a pan head.
Definition: vpPioneerPan.h:93
void set_eJe(double q_pan)
Definition: vpPioneerPan.h:135
void set_pMe(const double q)
Definition: vpPioneerPan.h:210
void set_mMp()
Definition: vpPioneerPan.h:188
vpHomogeneousMatrix mMp_
Definition: vpPioneerPan.h:224
vpHomogeneousMatrix pMe_
Definition: vpPioneerPan.h:225
void set_cMe()
Definition: vpPioneerPan.h:164
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:52
void set_eJe(const vpMatrix &eJe)
Definition: vpUnicycle.h:112
void set_cMe(const vpHomogeneousMatrix &cMe)
Definition: vpUnicycle.h:102