7 nodeHandle(node_handle),
8 simpleActionServer(name, false) {
39 sensor_msgs::JointState state;
42 state.position.resize(2);
43 state.velocity.resize(2);
44 state.name[0] =
"ptu_pan";
46 state.velocity[0] = 0;
47 state.name[1] =
"ptu_tilt";
49 state.velocity[1] = 0;
53 double currentDistance = sqrt(squaredSums);
83 ROS_ERROR(
"The PTU does not responde. Please check the PTU-Node");
93 if (pan_speed != 0 || tilt_speed != 0)
99 asr_flir_ptu_driver::Validate values_for_validation;
100 values_for_validation.request.pan = pan_candidate;
101 values_for_validation.request.tilt = tilt_candidate;
102 values_for_validation.request.margin =
getMargin();
104 if(values_for_validation.response.is_valid)
106 desired_pan = values_for_validation.response.new_pan;
110 ROS_ERROR(
"Values for pan %f and tilt %f do not lie within the working area of the ptu, neither do they lie within the margin %f out of the working area" 111 , pan_candidate, tilt_candidate,
getMargin());
116 ROS_ERROR(
"Failed to contact Validate service");
132 asr_flir_ptu_driver::State msg;
142 msg.no_check_forbidden_area =
false;
214 int main(
int argc,
char** argv)
216 ros::init(argc, argv,
"ptu_controller_actionlib");
218 std::string actionServerName;
219 n.
getParam(
"actionServerName", actionServerName);
asr_flir_ptu_controller::PTUMovementResult simpleActionServerResult
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
boost::shared_ptr< const Goal > acceptNewGoal()
void publishFeedback(const FeedbackConstPtr &feedback)
void publish(const boost::shared_ptr< M > &message) const
double getToleranceValue()
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
sensor_msgs::JointState stateCommandMessage
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
ROSCPP_DECL const std::string & getName()
ros::Subscriber stateSubscriber
ros::NodeHandle nodeHandle
int main(int argc, char **argv)
void setSucceeded(const Result &result=Result(), const std::string &text=std::string(""))
std::string validation_service
static const double RAD_TO_DEG
void setPreempted(const Result &result=Result(), const std::string &text=std::string(""))
std::string commandTopicName
void registerPreemptCallback(boost::function< void()> cb)
std::string getDefaultStateTopicName()
asr_flir_ptu_controller::PTUMovementFeedback simpleActionServerFeedback
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
#define ROS_DEBUG_STREAM(args)
void setAborted(const Result &result=Result(), const std::string &text=std::string(""))
sensor_msgs::JointState target_joint
void currentStateArrived(const asr_flir_ptu_driver::State::ConstPtr &msg)
std::string getDefaultStateCmdTopicName()
bool getParam(const std::string &key, std::string &s) const
std::string alive_service
ros::ServiceClient validate_client
ros::Publisher stateCommandPublisher
actionlib::SimpleActionServer< asr_flir_ptu_controller::PTUMovementAction > simpleActionServer
PTUController(ros::NodeHandle &n, std::string name)
void registerGoalCallback(boost::function< void()> cb)
void setMargin(double value)