Visual Servoing Platform  version 3.6.1 under development (2024-05-02)
vpRobotPololuPtu.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 Pololu Maestro PanTiltUnit.
32  */
33 
34 #ifndef _vpRobotPololuPtu_h_
35 #define _vpRobotPololuPtu_h_
36 
37 #include <visp3/core/vpConfig.h>
38 
39 #if defined(VISP_HAVE_POLOLU) && defined(VISP_HAVE_THREADS)
40 
41 #include <visp3/robot/vpRobot.h>
42 #include <visp3/robot/vpPololu.h>
43 
44 
63 class VISP_EXPORT vpRobotPololuPtu : public vpRobot
64 {
65 public:
73  vpRobotPololuPtu(const std::string &device = "/dev/ttyACM0", int baudrate = 9600, bool verbose = false);
74 
78  ~vpRobotPololuPtu() vp_override;
79 
89  void get_eJe(vpMatrix &eJe) vp_override;
90 
102  void get_eJe(const vpColVector &q, vpMatrix &eJe) const;
103 
110  void get_fJe(vpMatrix &fJe) vp_override;
111 
120  void get_fJe(const vpColVector &q, vpMatrix &fJe) const;
121 
126  float getAngularVelocityResolution() const;
127 
139  void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &q) vp_override;
140 
150  {
151  return m_positioning_velocity_percentage;
152  }
153 
168  void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &q) vp_override;
169 
178  void setPositioningVelocityPercentage(float positioning_velocity_percentage)
179  {
180  m_positioning_velocity_percentage = positioning_velocity_percentage;
181  }
182 
188  void setVerbose(bool verbose)
189  {
190  m_verbose = verbose;
191  }
192 
217  void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &q_dot) vp_override;
218 
222  void stopVelocity();
223 
229 
230 private:
237  void init() vp_override { };
238 
259  void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &d) vp_override
260  {
261  (void)frame;
262  (void)d;
263  };
264 
265  vpPololu m_pan;
266  vpPololu m_tilt;
267  float m_positioning_velocity_percentage;
268 
269  bool m_verbose;
270 };
271 
272 #endif
273 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:163
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:146
Interface for the Pololu Maestro USB Servo Controllers.
Definition: vpPololu.h:75
Interface for the Pololu Maestro pan-tilt unit using two servo motors.
float getPositioningVelocityPercentage() const
void setVerbose(bool verbose)
void setPositioningVelocityPercentage(float positioning_velocity_percentage)
Class that defines a generic virtual robot.
Definition: vpRobot.h:57
vpControlFrameType
Definition: vpRobot.h:75
virtual void get_eJe(vpMatrix &_eJe)=0
Get the robot Jacobian expressed in the end-effector frame.
virtual void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)=0
virtual void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position)=0
Get the robot position (frame has to be specified).
vpRobotStateType
Definition: vpRobot.h:63
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Definition: vpRobot.cpp:198
virtual void init()=0
virtual void get_fJe(vpMatrix &_fJe)=0
virtual void getDisplacement(const vpRobot::vpControlFrameType frame, vpColVector &q)=0
virtual void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &q)=0
Set a displacement (frame has to be specified) in position control.