SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
CHapticsChai.hpp
1 /* This file is part of scl, a control and simulation library
2  for robots and biomechanical models.
3 
4  scl is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 3 of the License, or (at your option) any later version.
8 
9  Alternatively, you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of
12  the License, or (at your option) any later version.
13 
14  scl is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License and a copy of the GNU General Public License along with
21  scl. If not, see <http://www.gnu.org/licenses/>.
22  */
23 /* \file CHapticsChai.hpp
24  *
25  * Created on: Sep 3, 2012
26  *
27  * Copyright (C) 2012
28  *
29  * Author: Samir Menon <smenon@stanford.edu>
30  */
31 
32 #ifndef CHAPTICSCHAI_HPP_
33 #define CHAPTICSCHAI_HPP_
34 
35 //For interfacing with chai
36 #include <scl/haptics/CHapticsBase.hpp>
37 
38 #include <Eigen/Core>
39 
40 #include <vector>
41 #include <string>
42 
43 // Forward declarations for chai classes so we don't have
44 // to include the chai header here. Instead, we can just
45 //include it in the .cpp file
46 namespace chai3d
47 {
48 class cHapticDeviceHandler;
49 class cGenericHapticDevice;
50 }
51 
52 namespace scl
53 {
54  class CHapticsChai : public CHapticsBase
55  {
56  public:
57  /* ********************************************************
58  * HAPTIC FUNCTIONS
59  * ******************************************************** */
65  virtual scl::sInt connectToDevices();
66 
70  virtual scl::sBool getHapticDevicePosition(const sUInt arg_id, Eigen::VectorXd& ret_pos_vec) const ;
71 
75  virtual scl::sBool getAllHapticDevicePositions(std::vector<Eigen::VectorXd>& ret_pos_vec) const ;
76 
78  virtual scl::sBool setHapticDeviceActuator(const sUInt arg_id, const Eigen::VectorXd& arg_cmd_vec)
79  { return false; }
80 
82  virtual scl::sBool setAllHapticDeviceActuators(const std::vector<Eigen::VectorXd>& arg_cmd_vec)
83  { return false; }
84 
85  /* Close the connections to the haptic devices */
86  virtual bool closeConnectionToDevices();
87 
89  virtual scl::sUInt getNumDevicesConnected()
90  { return static_cast<scl::sUInt>(haptic_devices_.size()); }
91 
92  /* ********************************************************
93  * INITIALIZTION FUNCTIONS
94  * ******************************************************** */
97 
99  ~CHapticsChai();
100 
101  /* ********************************************************
102  * DATA STRUCTURES
103  * ******************************************************** */
104  private:
106  std::vector<chai3d::cGenericHapticDevice*> haptic_devices_;
107 
110  chai3d::cHapticDeviceHandler* haptics_handler_;
111  };
112 }
113 
114 #endif /* CCHAIHAPTICS_HPP_ */
115 
Definition: CHapticsBase.hpp:51
virtual scl::sInt connectToDevices()
Definition: CHapticsChai.cpp:52
virtual scl::sUInt getNumDevicesConnected()
Definition: CHapticsChai.hpp:89
virtual scl::sBool getHapticDevicePosition(const sUInt arg_id, Eigen::VectorXd &ret_pos_vec) const
Definition: CHapticsChai.cpp:112
std::vector< chai3d::cGenericHapticDevice * > haptic_devices_
Definition: CHapticsChai.hpp:106
bool sBool
Definition: DataTypes.hpp:54
virtual scl::sBool getAllHapticDevicePositions(std::vector< Eigen::VectorXd > &ret_pos_vec) const
Definition: CHapticsChai.cpp:137
Definition: CHapticsChai.hpp:54
chai3d::cHapticDeviceHandler * haptics_handler_
Definition: CHapticsChai.hpp:110
virtual scl::sBool setAllHapticDeviceActuators(const std::vector< Eigen::VectorXd > &arg_cmd_vec)
Definition: CHapticsChai.hpp:82
~CHapticsChai()
Definition: CHapticsChai.cpp:44
int sInt
Definition: DataTypes.hpp:64
CHapticsChai()
Definition: CHapticsChai.hpp:96
virtual scl::sBool setHapticDeviceActuator(const sUInt arg_id, const Eigen::VectorXd &arg_cmd_vec)
Definition: CHapticsChai.hpp:78