ptu_manager.cpp
Go to the documentation of this file.
1 
19 
20 #ifndef Q_MOC_RUN
21 #include <sensor_msgs/JointState.h>
22 #include <ros/init.h>
23 #include <ptu_controller/PTUControllerClient.h>
24 #endif
25 
26 
27 PTU_Manager::PTU_Manager(double pan_min_angle, double pan_max_angle, double tilt_min_angle, double tilt_max_angle, int pan_step_count, int tilt_step_count)
28 {
30  controller = new asr_flir_ptu_controller::PTUController(n_, "ptu_controller");
31  //PTUMovementEndedCallback test( boost::bind( &PTU_Manager::ptu_callback, this, _1, _2) );
32  //callbackPtr = PTUMovementEndedCallbackPtr(boost::make_shared<PTUMovementEndedCallback>(test));
33  pan_step = 0;
34  tilt_step = 0;
35  pan_step_add = 1;
36  this->pan_min_angle = pan_min_angle;
37  this->pan_max_angle = pan_max_angle;
38  this-> tilt_min_angle = tilt_min_angle;
39  this->tilt_max_angle = tilt_max_angle;
40  this->pan_stepsize = (pan_max_angle - pan_min_angle) / (double)pan_step_count;
41  this->tilt_stepsize = (tilt_max_angle - tilt_min_angle) / (double)tilt_step_count;
42 }
43 
44 void PTU_Manager::ptu_callback(double pan, double tilt)
45 {
46  currentPan = pan;
47  currentTilt = tilt;
48  ptu_moved(pan, tilt);
49 }
50 
52 {
53  pan_step = 0;
54  tilt_step = 0;
56  return true ;
57 }
58 
60 {
61  sendJoint(0,0,true);
62  return true;
63 }
64 
66 {
69  {
70  pan_step_add *= -1;
72  tilt_step ++;
73  }
75  {
76 
78  return true;
79  }
80  else
81  {
82  return false;
83  }
84 }
85 
86 void PTU_Manager::sendJoint(double pan, double tilt, bool wait)
87 {
88  ROS_DEBUG_STREAM("PTU: Sending joint to " << pan<< ", " << tilt);
89  if (wait)
90  {
91  //controller->moveTo(pan, tilt);
92  }
93  else
94  {
95  //controller->asyncMoveTo(pan, tilt, callbackPtr);
96  }
97 }
98 
100 {
101  return currentPan;
102 }
103 
105 {
106  return currentTilt;
107 }
108 
double getTilt()
void ptu_moved(double pan, double tilt)
int pan_step_count
Definition: ptu_manager.h:49
double pan_min_angle
Definition: ptu_manager.h:43
asr_flir_ptu_controller::PTUController * controller
Definition: ptu_manager.h:58
double pan_stepsize
Definition: ptu_manager.h:47
void sendJoint(double pan, double tilt, bool wait)
Definition: ptu_manager.cpp:86
bool setStartPose()
Definition: ptu_manager.cpp:51
double pan_max_angle
Definition: ptu_manager.h:44
bool nextPose()
Definition: ptu_manager.cpp:65
double tilt_stepsize
Definition: ptu_manager.h:48
#define ROS_DEBUG_STREAM(args)
double currentPan
Definition: ptu_manager.h:52
double getPan()
Definition: ptu_manager.cpp:99
double tilt_min_angle
Definition: ptu_manager.h:45
void ptu_callback(double pan, double tilt)
Definition: ptu_manager.cpp:44
int tilt_step_count
Definition: ptu_manager.h:50
double currentTilt
Definition: ptu_manager.h:53
int pan_step_add
Definition: ptu_manager.h:57
double tilt_max_angle
Definition: ptu_manager.h:46
bool setNeutralPose()
Definition: ptu_manager.cpp:59
PTU_Manager(double pan_min_angle, double pan_max_angle, double tilt_min_angle, double tilt_max_angle, int pan_step_count, int tilt_step_count)
Definition: ptu_manager.cpp:27


asr_mild_calibration_tool
Author(s): Aumann Florian, Heller Florian, Meißner Pascal
autogenerated on Mon Dec 2 2019 03:11:43