vpRobotFrankaSim.h
Go to the documentation of this file.
1 /*
2  * This file is part of the ViSP software.
3  * Copyright (C) 2005 - 2021 by INRIA. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * ("GPL") version 2 as published by the Free Software Foundation.
8  * See the file LICENSE.txt at the root directory of this source
9  * distribution for additional information about the GNU GPL.
10  *
11  * For using ViSP with software that can not be combined with the GNU
12  * GPL, please contact INRIA about acquiring a ViSP Professional
13  * Edition License.
14  *
15  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
16  *
17  * This software was developed at:
18  * INRIA Rennes - Bretagne Atlantique
19  * Campus Universitaire de Beaulieu
20  * 35042 Rennes Cedex
21  * France
22  * http://www.irisa.fr/lagadic
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  * Franka robot simulator.
32  *
33  * Authors:
34  * Alexander Oliva
35  * Fabien Spindler
36  */
37 
38 #ifndef vpRobotFrankaSim_h
39 #define vpRobotFrankaSim_h
40 
41 #include <atomic>
42 #include <mutex>
43 #include <thread>
44 
45 #include <visp3/core/vpConfig.h>
46 #include <visp3/core/vpPoseVector.h>
47 #include <visp3/core/vpThetaUVector.h>
48 #include <visp3/robot/vpRobot.h>
49 
50 #if defined( VISP_HAVE_OROCOS_KDL )
51 
52 #ifdef VISP_HAVE_OROCOS_KDL
53 #include <kdl/chain.hpp>
54 #include <kdl/chainfksolver.hpp>
55 #include <kdl/chainfksolverpos_recursive.hpp>
56 #include <kdl/chainiksolverpos_nr.hpp>
57 #include <kdl/chainiksolverpos_nr_jl.hpp>
58 #include <kdl/chainiksolvervel_pinv.hpp>
59 #include <kdl/chainjnttojacsolver.hpp>
60 #include <kdl/frames_io.hpp>
61 #include <kdl/solveri.hpp>
62 #endif
63 
67 class VISP_EXPORT vpRobotFrankaSim
68 {
69 public:
71  virtual ~vpRobotFrankaSim();
72 
73  vpRobot::vpRobotStateType getRobotState( void );
74 
75  void get_fJe( vpMatrix &fJe );
76  void get_fJe( const vpColVector &q, vpMatrix &fJe );
77  void get_eJe( vpMatrix &eJe_ );
78  void get_eJe( const vpColVector &q, vpMatrix &fJe );
79  vpHomogeneousMatrix get_eMc() const;
80  vpHomogeneousMatrix get_fMe( const vpColVector &q );
81  vpHomogeneousMatrix get_fMe();
82  vpHomogeneousMatrix get_flMe() const;
83  vpHomogeneousMatrix get_flMcom() const;
84  double get_tool_mass() const;
85 
86  void getGravity( vpColVector &gravity );
87  void getMass( vpMatrix &mass );
88  void getCoriolis( vpColVector &coriolis );
89  void getCoriolisMatrix( vpMatrix &coriolis );
90  void getFriction( vpColVector &friction );
91 
92  virtual void getForceTorque( const vpRobot::vpControlFrameType frame, vpColVector &force );
93  virtual void getPosition( const vpRobot::vpControlFrameType frame, vpColVector &position );
94  virtual void getPosition( const vpRobot::vpControlFrameType frame, vpPoseVector &position );
95  virtual void getVelocity( const vpRobot::vpControlFrameType frame, vpColVector &d_position );
96 
97  virtual void set_eMc( const vpHomogeneousMatrix &eMc );
98  virtual void setForceTorque( const vpRobot::vpControlFrameType frame, const vpColVector &force );
99  virtual void setPosition( const vpRobot::vpControlFrameType frame, const vpColVector &position );
100  virtual void setVelocity( const vpRobot::vpControlFrameType frame, const vpColVector &vel );
101 
102  virtual void add_tool( const vpHomogeneousMatrix &flMe, const double mL, const vpHomogeneousMatrix &flMcom,
103  const vpMatrix &I_L );
104  virtual void set_flMe( const vpHomogeneousMatrix &flMe );
105  virtual void set_g0( const vpColVector &g0 );
106 
111  inline void setVerbose( bool verbose ) { m_verbose = verbose; }
112 
113 protected:
114  vpColVector m_q; // Joint Positions
115  vpColVector m_dq; // Joint Velocities
116  vpColVector m_tau_J; // Joint efforts
117 
118  double m_mL; // payload mass
119  vpHomogeneousMatrix m_flMcom; // payload Center of Mass pose in flange frame
120  vpMatrix m_Il; // payload inertia tensor
121  vpHomogeneousMatrix m_flMe; // End-effector pose in flange frame
122  bool m_toolMounted; // flag to indicate the presence of a tool
123  bool m_camMounted; // flag to indicate the presence of a camera
124 
125  vpColVector m_g0; // Absolute gravitational acceleration vector in base frame
126 
127  std::mutex m_mutex;
128 
129  vpColVector solveIK( const vpHomogeneousMatrix &edMw );
130  vpColVector getVelDes();
131 
132 #ifdef VISP_HAVE_OROCOS_KDL
142 #endif
143 
144  vpRobot::vpRobotStateType m_stateRobot;
145 
146  vpColVector m_q_des; // Desired joint position.
147 
148  vpColVector m_dq_des; // Desired joint velocity.
149  vpColVector m_dq_des_filt; // Desired joint velocity filtered.
150  vpColVector m_v_cart_des; // Desired Cartesian velocity in end-effector frame.
151 
152  vpColVector m_tau_J_des; // Desired joint torques.
153  vpColVector m_tau_J_des_filt; // Desired joint torques filtered.
154 
155  vpHomogeneousMatrix m_eMc; // Transformation of the camera w.r.t. End-Effector frame
156  vpVelocityTwistMatrix m_eVc;
157 
158  bool m_verbose;
159 };
160 
161 #endif
162 #endif
vpColVector friction(const vpColVector &dq)
vpColVector m_dq_des_filt
vpColVector m_tau_J_des_filt
vpColVector m_tau_J_des
KDL::Chain m_chain_kdl
KDL::JntArray m_q_max_kdl
KDL::JntArray m_dq_des_kdl
KDL::ChainFkSolverPos_recursive * m_fksolver_kdl
KDL::JntArray m_q_min_kdl
vpColVector m_dq_des
KDL::ChainIkSolverVel_pinv * m_diffIkSolver_kdl
vpVelocityTwistMatrix m_eVc
KDL::ChainJntToJacSolver * m_jacobianSolver_kdl
void setVerbose(bool verbose)
vpColVector m_v_cart_des
vpHomogeneousMatrix m_flMcom
KDL::JntArray m_q_kdl
vpHomogeneousMatrix m_eMc
vpHomogeneousMatrix m_flMe
vpRobot::vpRobotStateType m_stateRobot
KDL::ChainIkSolverPos_NR_JL * m_iksolver_JL_kdl


visp_ros
Author(s): Francois Pasteau, Fabien Spindler, Gatien Gaumerais, Alexander Oliva
autogenerated on Tue Mar 1 2022 00:03:22