Visual Servoing Platform  version 3.6.1 under development (2024-04-24)
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/vpHomogeneousMatrix.h>
37 #include <visp3/core/vpRxyzVector.h>
38 #include <visp3/core/vpTranslationVector.h>
39 #include <visp3/robot/vpUnicycle.h>
40 
90 class VISP_EXPORT vpPioneerPan : public vpUnicycle
91 {
92 public:
96  vpPioneerPan() : mMp_(), pMe_()
97  {
98  double q = 0; // Initial position of the pan axis
99  set_mMp();
100  set_pMe(q);
101  set_cMe();
102  set_eJe(q);
103  }
104 
107 
133  void set_eJe(double q_pan)
134  {
135  double px = mMp_[0][3];
136  double py = mMp_[1][3];
137  double c1 = cos(q_pan);
138  double s1 = sin(q_pan);
139 
140  eJe_.resize(6,
141  3); // robot jacobian expressed at the pan head end effector
142 
143  eJe_ = 0;
144  eJe_[0][0] = c1;
145  eJe_[0][1] = -c1 * py - s1 * px;
146 
147  eJe_[2][0] = s1;
148  eJe_[2][1] = -s1 * py + c1 * px;
149 
150  eJe_[4][1] = -1;
151  eJe_[4][2] = 1;
152  }
154 
155 protected:
162  void set_cMe()
163  {
164  // Position of pan head end effector frame in the camera frame
165  double cx = 0;
166  double cy = -0.065; // distance between camera and tilt axis
167  double cz = 0;
168  vpTranslationVector etc(cx, cy, cz);
169  vpRotationMatrix eRc;
170  eRc[0][0] = eRc[1][1] = eRc[2][2] = 0;
171  eRc[0][2] = 1;
172  eRc[1][1] = 1;
173  eRc[2][0] = -1;
174 
176  eMc.buildFrom(etc, eRc);
177 
178  cMe_ = eMc.inverse();
179  }
180 
186  void set_mMp()
187  {
188  // Position of the pan head in the mobile platform frame
189  double px = 0.103; // distance between the pan frame and the robot frame
190  double py = 0;
191  double pz = 0.27;
193  mtp.set(px, py, pz);
194 
195  vpRotationMatrix mRp; // set to Identity
196  mRp[1][1] = mRp[2][2] = -1.;
197 
198  mMp_.insert(mtp);
199  mMp_.insert(mRp);
200  }
201 
208  void set_pMe(const double q)
209  {
210  vpRotationMatrix pRe;
211  pRe[0][0] = cos(q);
212  pRe[0][2] = pRe[1][0] = sin(q);
213  pRe[1][1] = pRe[2][2] = 0.;
214  pRe[2][1] = 1.;
215  pRe[1][2] = -pRe[0][0];
216 
217  pMe_.insert(pRe);
218  }
220 
221 protected:
223  vpHomogeneousMatrix pMe_; // depends on q pan
224 };
225 
226 #endif
void insert(const vpArray2D< Type > &A, unsigned int r, unsigned int c)
Definition: vpArray2D.h:484
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 equipped with a pan head.
Definition: vpPioneerPan.h:91
void set_eJe(double q_pan)
Definition: vpPioneerPan.h:133
void set_pMe(const double q)
Definition: vpPioneerPan.h:208
void set_mMp()
Definition: vpPioneerPan.h:186
vpHomogeneousMatrix mMp_
Definition: vpPioneerPan.h:222
vpHomogeneousMatrix pMe_
Definition: vpPioneerPan.h:223
void set_cMe()
Definition: vpPioneerPan.h:162
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:50
void set_eJe(const vpMatrix &eJe)
Definition: vpUnicycle.h:110
void set_cMe(const vpHomogeneousMatrix &cMe)
Definition: vpUnicycle.h:100