Main Page
Classes
Files
File List
File Members
src
CameraUtils
ptu_manager.cpp
Go to the documentation of this file.
1
18
#include "
CameraUtils/ptu_manager.h
"
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
{
29
ros::NodeHandle
n_ =
ros::NodeHandle
();
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
51
bool
PTU_Manager::setStartPose
()
52
{
53
pan_step
= 0;
54
tilt_step
= 0;
55
sendJoint
(
pan_min_angle
,
tilt_min_angle
,
true
);
56
return
true ;
57
}
58
59
bool
PTU_Manager::setNeutralPose
()
60
{
61
sendJoint
(0,0,
true
);
62
return
true
;
63
}
64
65
bool
PTU_Manager::nextPose
()
66
{
67
pan_step
+=
pan_step_add
;
68
if
(
pan_step
*
pan_stepsize
+
pan_min_angle
>
pan_max_angle
||
pan_step
< 0)
69
{
70
pan_step_add
*= -1;
71
pan_step
+=
pan_step_add
;
72
tilt_step
++;
73
}
74
if
(
tilt_step
*
tilt_stepsize
+
tilt_min_angle
<=
tilt_max_angle
)
75
{
76
77
sendJoint
(
pan_min_angle
+
pan_step
*
pan_stepsize
,
tilt_min_angle
+
tilt_step
*
tilt_stepsize
,
false
);
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
99
double
PTU_Manager::getPan
()
100
{
101
return
currentPan
;
102
}
103
104
double
PTU_Manager::getTilt
()
105
{
106
return
currentTilt
;
107
}
108
PTU_Manager::getTilt
double getTilt()
Definition:
ptu_manager.cpp:104
PTU_Manager::ptu_moved
void ptu_moved(double pan, double tilt)
PTU_Manager::pan_step_count
int pan_step_count
Definition:
ptu_manager.h:49
ros::NodeHandle
init.h
PTU_Manager::pan_step
int pan_step
Definition:
ptu_manager.h:55
PTU_Manager::pan_min_angle
double pan_min_angle
Definition:
ptu_manager.h:43
PTU_Manager::controller
asr_flir_ptu_controller::PTUController * controller
Definition:
ptu_manager.h:58
PTU_Manager::tilt_step
int tilt_step
Definition:
ptu_manager.h:56
PTU_Manager::pan_stepsize
double pan_stepsize
Definition:
ptu_manager.h:47
PTU_Manager::sendJoint
void sendJoint(double pan, double tilt, bool wait)
Definition:
ptu_manager.cpp:86
PTU_Manager::setStartPose
bool setStartPose()
Definition:
ptu_manager.cpp:51
PTU_Manager::pan_max_angle
double pan_max_angle
Definition:
ptu_manager.h:44
PTU_Manager::nextPose
bool nextPose()
Definition:
ptu_manager.cpp:65
PTU_Manager::tilt_stepsize
double tilt_stepsize
Definition:
ptu_manager.h:48
ROS_DEBUG_STREAM
#define ROS_DEBUG_STREAM(args)
PTU_Manager::currentPan
double currentPan
Definition:
ptu_manager.h:52
PTU_Manager::getPan
double getPan()
Definition:
ptu_manager.cpp:99
ptu_manager.h
PTU_Manager::tilt_min_angle
double tilt_min_angle
Definition:
ptu_manager.h:45
PTU_Manager::ptu_callback
void ptu_callback(double pan, double tilt)
Definition:
ptu_manager.cpp:44
PTU_Manager::tilt_step_count
int tilt_step_count
Definition:
ptu_manager.h:50
PTU_Manager::currentTilt
double currentTilt
Definition:
ptu_manager.h:53
PTU_Manager::pan_step_add
int pan_step_add
Definition:
ptu_manager.h:57
PTU_Manager::tilt_max_angle
double tilt_max_angle
Definition:
ptu_manager.h:46
PTU_Manager::setNeutralPose
bool setNeutralPose()
Definition:
ptu_manager.cpp:59
PTU_Manager::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)
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