phidgets_getdata_synchronous.h
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2014, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
27 
33 #ifndef SIMPLE_H
34 #define SIMPLE_H
35 
36 #include <stdio.h>
37 
38 #include <phidget21.h>
39 
40 #include <ros/ros.h>
41 
42 #include <ros/package.h>
43 
44 #include <boost/asio.hpp>
45 #include <boost/bind.hpp>
46 #include <boost/thread.hpp>
47 
48 #include <sensor_msgs/Range.h>
49 #include <pressure_cells/SenVal.h>
50 #include <visualization_msgs/Marker.h>
51 
52 
53 class PhidgetClass
54 {
55  public:
56 
57  PhidgetClass(boost::asio::io_service& io_service,ros::NodeHandle& nh_);
58 
59  void start();
60  int AttachHandler(CPhidgetHandle IFK);
61  int DetachHandler(CPhidgetHandle IFK);
62  int ErrorHandler(CPhidgetHandle IFK, int ErrorCode, const char *unknown);
63 
64  void irHandler(boost::system::error_code const& cError);
65  void highRateHandler(boost::system::error_code const& cError);
66 
67  int readIRSensors();
68  int calibrateIRSensors();
69  void publishIRValues();
70  int readFSRSensors();
71  int calibrateFSRSensors();
72  void publishFSRValues();
73  void FSR_pub();
74 
75  int readLCSensors();
76  int calibrateLCSensors();
77  void publishLCValues();
78  void LC_pub();
79 
80  int ir1_value;
81  int ir2_value;
82  int fsr1_value;
83  int fsr2_value;
84  int fsr3_value;
85  int fsr4_value;
86  int lc1_value;
87  int lc2_value;
88 
89  double LC1_data, LC2_data, LC3_data;
90  double FSR1_data, FSR2_data, FSR3_data;
91  double IR1_data, IR2_data, IR3_data;
92 
96 
100 
104 
105  private:
106 
107  sensor_msgs::Range ir1;
108  sensor_msgs::Range ir2;
109  pressure_cells::SenVal ForceVal;
110 
111  uint ir1_index;
112  uint ir2_index;
113 
114  uint fsr1_index;
115  uint fsr2_index;
116  uint fsr3_index;
117  uint fsr4_index;
118 
119  uint lc12_index;
120  uint lc34_index;
121 
122  uint ir_period;
123  uint high_rate_period;
124 
125  boost::asio::deadline_timer ir_timer;
126  boost::asio::deadline_timer high_rate_timer;
127 
128 
129  ros::Publisher ir1_publisher;
130  ros::Publisher ir2_publisher;
131 
132  ros::Publisher ForceVal_publisher;
133 
134  visualization_msgs::Marker LC_marker;
135  visualization_msgs::Marker FSR_marker;
136 
137  ros::Publisher LC_marker_pub;
138  ros::Publisher FSR_marker_pub;
139 
140  ros::NodeHandle nh;
141 
142  CPhidgetInterfaceKitHandle ifKit;
143 };
144 
145 #endif //SIMPLE_H
sensor_msgs::Range ir2
sensor_msgs::Range ir1
boost::asio::deadline_timer ir_timer
visualization_msgs::Marker FSR_marker
int ErrorHandler(CPhidgetHandle IFK, int ErrorCode, const char *unknown)
visualization_msgs::Marker LC_marker
pressure_cells::SenVal ForceVal
void highRateHandler(boost::system::error_code const &cError)
LC/FSR Handler - High rate 100Hz.
void LC_pub()
Markers declaration.
ros::Publisher ForceVal_publisher
void irHandler(boost::system::error_code const &cError)
IR Handler - Low rate 40Hz.
int readIRSensors()
IR Sensor FUNCTIONS.
boost::asio::deadline_timer high_rate_timer
CPhidgetInterfaceKitHandle ifKit
PhidgetClass(boost::asio::io_service &io_service)
int AttachHandler(CPhidgetHandle IFK)
int DetachHandler(CPhidgetHandle IFK)


pedal_monitor
Author(s): Pedro Mendes
autogenerated on Mon Mar 2 2015 01:32:33