interface_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 #include <fstream>
38 #include <iostream>
39 #include <phidget21.h>
40 
41 #include <ros/ros.h>
42 
43 #include <ros/package.h>
44 
45 #include <boost/asio.hpp>
46 #include <boost/bind.hpp>
47 #include <boost/thread.hpp>
48 
49 #include <boost/property_tree/ptree.hpp>
50 #include <boost/property_tree/xml_parser.hpp>
51 #include <boost/foreach.hpp>
52 #include <boost/shared_ptr.hpp>
53 #include <vector>
54 
55 // GTK INCLUDES
56 #include <stdlib.h>
57 #include <math.h>
58 #include <time.h>
59 #include <ctype.h>
60 #include <string.h>
61 #include <fcntl.h>
62 #include <sys/time.h>
63 #include <unistd.h>
64 #include "opencv2/core/core.hpp"
65 #include <signal.h>
66 #include <sys/types.h>
67 #include <sys/ipc.h>
68 #include <sys/shm.h>
69 #include <assert.h>
70 #include <gtk/gtk.h>
71 #include <gdk/gdkkeysyms.h>
72 
73 
75 {
76  public:
77 
78  PhidgetClass(boost::asio::io_service& io_service);
79 
80  void start();
81  int AttachHandler(CPhidgetHandle IFK);
82  int DetachHandler(CPhidgetHandle IFK);
83  int ErrorHandler(CPhidgetHandle IFK, int ErrorCode, const char *unknown);
84 
85  void irHandler(boost::system::error_code const& cError);
86  void highRateHandler(boost::system::error_code const& cError);
87 
88  int readIRSensors();
89  int readFSRSensors();
90  int readLCSensors();
91  int calibrateIRSensors();
92  int calibrateFSRSensors();
93  int calibrateLCSensors();
94 
95  int ir1_value;
96  int ir2_value;
103 
107 
110 
113 
116 
117  private:
118 
119  uint ir1_index;
120  uint ir2_index;
121 
126 
129 
130  uint ir_period;
132 
133  boost::asio::deadline_timer ir_timer;
134  boost::asio::deadline_timer high_rate_timer;
135 
136  CPhidgetInterfaceKitHandle ifKit;
137 };
138 
139 // ===================== GTK FUNCTIONS ============================
140 extern "C" void callback_about(GtkWidget * window, gpointer data) ;
141 extern "C" void callback_back_function(GtkWidget * window, gpointer data) ;
142 extern "C" void callback_load_config(GtkWidget * widget, gpointer user_data) ;
143 extern "C" void callback_new_config(GtkWidget * widget, gpointer user_data) ;
144 extern "C" void callback_open_new(GtkWidget * widget, gpointer user_data) ;
145 extern "C" void callback_set_data(GtkWidget * widget, gpointer user_data) ;
146 extern "C" void delete_event(GtkWidget * window, GdkEvent * event, gpointer data) ;
147 extern "C" void callback_opendialog_cancel(GtkWidget * widget, gpointer user_data);
148 extern "C" void callback_opendialog_open(GtkWidget * widget, gpointer user_data);
149 extern "C" void callback_opendialog_save(GtkWidget * widget, gpointer user_data);
150 extern "C" void callback_IR_error(GtkWidget * widget, gpointer user_data);
151 
152 
153 gboolean real_time_monitor(gpointer progressbar) ;
154 
155 #endif //SIMPLE_H
void callback_opendialog_open(GtkWidget *widget, gpointer user_data)
void callback_back_function(GtkWidget *window, gpointer data)
Function to return to main window.
boost::asio::deadline_timer ir_timer
void callback_about(GtkWidget *window, gpointer data)
Function to open the about window.
void callback_opendialog_cancel(GtkWidget *widget, gpointer user_data)
void callback_new_config(GtkWidget *widget, gpointer user_data)
Function to start a new calibration.
void callback_load_config(GtkWidget *widget, gpointer user_data)
Function to load an existent calibration.
int ErrorHandler(CPhidgetHandle IFK, int ErrorCode, const char *unknown)
void callback_opendialog_save(GtkWidget *widget, gpointer user_data)
void highRateHandler(boost::system::error_code const &cError)
LC/FSR Handler - High rate 100Hz.
void delete_event(GtkWidget *window, GdkEvent *event, gpointer data)
Function to detect that you are leaving main window.
void irHandler(boost::system::error_code const &cError)
IR Handler - Low rate 40Hz.
int readIRSensors()
IR Sensor FUNCTIONS.
void callback_set_data(GtkWidget *widget, gpointer user_data)
Function with the instructions for the configuration.
boost::asio::deadline_timer high_rate_timer
CPhidgetInterfaceKitHandle ifKit
void callback_open_new(GtkWidget *widget, gpointer user_data)
Function to open the new calibration dialog.
PhidgetClass(boost::asio::io_service &io_service)
gboolean real_time_monitor(gpointer progressbar)
Function to get the values in realtime for new config.
int AttachHandler(CPhidgetHandle IFK)
void callback_IR_error(GtkWidget *widget, gpointer user_data)
int DetachHandler(CPhidgetHandle IFK)


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