12     node_handle.
getParam(
"speed_control", speed_control);
    13     node_handle.
getParam(
"mockPTU", mock_PTU);
    19         bool no_device_found = 
true;
    20         while(no_device_found) {
    21             no_device_found = 
false;
    25             catch(std::exception &e) {
    26                 ROS_ERROR(
"NO DEVICE FOUND CONNECTED TO SERIAL PORT %s", port.c_str());
    27                 no_device_found = 
true;
    42     ROS_INFO(
"PTU is fully initialized.");
    75     double pan = msg->state.position[0];
    76     double tilt = msg->state.position[1];
    77     double pan_speed = msg->state.velocity[0];
    78     double tilt_speed = msg->state.velocity[1];
    80     ROS_DEBUG_STREAM(
"Node received state_cmd message: (p,t)=(" << pan << 
"," << tilt << 
") and (v_p,v_t)=(" << pan_speed << 
"," << tilt_speed << 
").");
    86         ROS_DEBUG(
"PTU is NOT in SpeedcontrolMode");
    99     double tilt = req.tilt;
   100     double margin = req.margin;
   104             res.is_valid = 
false;
   113         res.is_valid = 
false;
   121 bool PTUNode::predict(asr_flir_ptu_driver::Predict::Request &req, asr_flir_ptu_driver::Predict::Response &res) {
   123     res.new_pan = legit_end_point[0];
   124     res.new_tilt = legit_end_point[1];
   140 bool PTUNode::getRange(asr_flir_ptu_driver::Range::Request &req, asr_flir_ptu_driver::Range::Response &res)
   146     std::vector<double> forbidden_pan_min, forbidden_pan_max, forbidden_tilt_min, forbidden_tilt_max;
   151     res.forbidden_pan_min = forbidden_pan_min;
   152     res.forbidden_pan_max = forbidden_pan_max;
   153     res.forbidden_tilt_min = forbidden_tilt_min;
   154     res.forbidden_tilt_max = forbidden_tilt_max;
   160       int pan_base, pan_speed, pan_upper, pan_accel;
   161       int tilt_base, tilt_speed, tilt_upper, tilt_accel;
   162       int pan_hold, pan_move;
   163       int tilt_hold, tilt_move;
   164       double pan_min, pan_max;
   165       double tilt_min, tilt_max;
   168       double computation_tolerance;
   193       std::vector<double> forbidden_pan_min;
   194       std::vector<double> forbidden_pan_max;
   195       std::vector<double> forbidden_tilt_min;
   196       std::vector<double> forbidden_tilt_max;
   202       std::vector< std::map< std::string, double> > forbidden_areas;
   203       for (
unsigned int i = 0; i < forbidden_pan_min.size(); i++)
   205           std::map< std::string, double> area;
   206           area[
"pan_min"] = forbidden_pan_min.at(i);
   207           area[
"pan_max"] = forbidden_pan_max.at(i);
   208           area[
"tilt_min"] = forbidden_tilt_min.at(i);
   209           area[
"tilt_max"] = forbidden_tilt_max.at(i);
   210           if (forbidden_pan_min.at(i) < forbidden_pan_max.at(i) &&
   211               forbidden_tilt_min.at(i) < forbidden_tilt_max.at(i))
   212         forbidden_areas.push_back(area);
   214           ROS_DEBUG(
"forbidden_pan_min:%f, forbidden_pan_min:%f",  forbidden_pan_min.at(i),  forbidden_pan_max.at(i));
   215           ROS_DEBUG(
"forbidden_tilt_min:%f, forbidden_tilt_max:%f",  forbidden_tilt_min.at(i),  forbidden_tilt_max.at(i));
   219       ROS_DEBUG(
"double minPan:%f, double maxPan:%f",  pan_min,  pan_max);
   220       ROS_DEBUG(
"double tiltMin:%f, double tiltMax:%f",  tilt_min,  tilt_max);
   224       ptu->
setSettings(pan_base, tilt_base, pan_speed, tilt_speed, pan_upper, tilt_upper, pan_accel,
   225                tilt_accel, pan_hold, tilt_hold, pan_move, tilt_move);
   289     int pan_speed, tilt_speed;
   323         sensor_msgs::JointState state;
   324         asr_flir_ptu_driver::State msg;
   327         state.name.resize(2);
   328         state.position.resize(2);
   329         state.velocity.resize(2);
   330         state.name[0] = 
"ptu_pan";
   333         state.name[1] = 
"ptu_tilt";
   355 int main(
int argc, 
char **argv) {
   360         double update_rate = 100;
   361     n.
getParam(
"update_rate", update_rate);
 virtual void setSpeedControlMode(bool speed_control_mode)
setSpeedControlMode Method to set and disable pure speed control mode 
virtual bool isConnected()
isConnected Method to check if ptu is connected. 
virtual std::vector< double > determineLegitEndPoint(double end_point_pan_candidate, double end_point_tilt_candidate)
determineLegitEndPoint Method to determine an end point which is not inside a forbidden area using pa...
std::string ptu_pan_frame
bool validatePanTilt(asr_flir_ptu_driver::Validate::Request &req, asr_flir_ptu_driver::Validate::Response &res)
virtual void setComputationTolerance(double computation_tolerance)
setComputationTolerance Sets the tolerance value for errors due to the imprecise nature of float...
std::string ptu_tilt_frame_rotated
virtual void setDistanceFactor(long distance_factor)
setDistanceFactor Method to set the factor which determines how much samples are going to be taken fo...
bool updateSpeedControl(std_srvs::Empty::Request &, std_srvs::Empty::Response &)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
virtual bool setAbsoluteAngles(double pan_angle, double tilt_angle, bool no_forbidden_area_check)
setAbsoluteAngles Method to set pan and tilt angle for the PTU 
virtual bool isInSpeedControlMode()
isInSpeedControlMode Method to determine if ptu is in pure speed control mode 
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
int main(int argc, char **argv)
ros::ServiceServer alive_service
virtual bool setValuesOutOfLimitsButWithinMarginToLimit(double *pan, double *tilt, double margin)
setValuesOutOfLimitsButWithinMarginToLimit This method is used to set pan/tilt values that are slighl...
virtual long getLimitAngle(char pan_or_tilt, char upper_or_lower)
!!!!!!!!!Müssen nachfolgende public sein? Nach erstellen von mock überprüfen!!!!!!!!!!! ...
virtual void setSettings(int pan_base, int tilt_base, int pan_speed, int tilt_speed, int pan_upper, int tilt_upper, int pan_accel, int tilt_accel, int pan_hold, int tilt_hold, int pan_move, int tilt_move)
setSettings Method to configure various settings of the ptu 
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
void setState(const asr_flir_ptu_driver::State::ConstPtr &msg)
virtual void setLimitAngles(double pan_min, double pan_max, double tilt_min, double tilt_max)
setSettings Method to configure limits for pan and tilt 
ros::Publisher joint_pub_old
PTUNode(ros::NodeHandle &n)
PTUNode Constructor for PTUNode class. 
void publish(const boost::shared_ptr< M > &message) const
std::string service_path_prediction
bool predict(asr_flir_ptu_driver::Predict::Request &req, asr_flir_ptu_driver::Predict::Response &res)
bool getParam(const std::string &key, std::string &s) const
virtual void setForbiddenAreas(std::vector< std::map< std::string, double > > forbidden_areas)
setForbiddenAreas Method to set all forbidden areas for the PTU. Former forbidden areas will be disca...
std::string ptu_pan_frame_rotated
bool ok()
ok Method to check if the PTUNode is still working 
std::string service_range
ros::Subscriber joint_sub
virtual double getAngleSpeed(char type)
getAngleSpeed Method to get the current angle speed of an axisa (deg/s) 
std::string service_validation
ros::ServiceServer settings_service
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ros::ServiceServer validate_service
virtual double getCurrentAngle(char type)
getCurrentAngle Method to get the current pan/tilt angle 
std::string topic_state_command
#define ROS_DEBUG_STREAM(args)
bool getRange(asr_flir_ptu_driver::Range::Request &req, asr_flir_ptu_driver::Range::Response &res)
bool hasParam(const std::string &key) const
tf::TransformBroadcaster tb_pan
virtual bool hasHaltedAndReachedGoal()
hasHaltedAndReachedGoal Method to determine if the PTU has halted and reached its goal ...
static constexpr double DEG_TO_RAD
const std::string & getNamespace() const
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const
asr_flir_ptu_driver::PTUDriver * ptu
ros::ServiceServer path_prediction_service
std::string ptu_topic_state
bool updateSettings(std_srvs::Empty::Request &, std_srvs::Empty::Response &)
std::string service_alive
virtual bool isInForbiddenArea(double pan_angle, double tilt_angle)
isInForbiddenArea method to determine if a pan + tilt value pair lies within a forbidden area...
void spinOnce()
spinOnce Method that is used to spin the PTUNode once, including ros::spinOnce(). Run this in a loop...
ROSCPP_DECL void spinOnce()
ros::NodeHandle node_handle
virtual void setAbsoluteAngleSpeeds(double pan_speed, double tilt_speed)
setAbsoluteAngleSpeeds Method to set desired speed for pan/tilt movement absolute in deg/s ...
bool emptyAlive(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
std::string service_settings_update
ros::ServiceServer speedmode_service
std::string service_speed_control_update
std::string ptu_tilt_frame
tf::TransformBroadcaster tb_tilt
ros::ServiceServer range_service