interactive_frame_target.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *   http://www.apache.org/licenses/LICENSE-2.0
00009 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 
00018 #ifndef INTERACTIVE_FRAME_TARGET_H
00019 #define INTERACTIVE_FRAME_TARGET_H
00020 
00021 #include <string>
00022 #include <ros/ros.h>
00023 
00024 #include <std_srvs/Trigger.h>
00025 #include <cob_srvs/SetString.h>
00026 #include <geometry_msgs/PoseStamped.h>
00027 
00028 #include <tf/transform_listener.h>
00029 #include <tf/transform_broadcaster.h>
00030 #include <tf/transform_datatypes.h>
00031 
00032 #include <interactive_markers/interactive_marker_server.h>
00033 #include <interactive_markers/menu_handler.h>
00034 
00035 
00036 
00037 class InteractiveFrameTarget
00038 {
00039 public:
00040     InteractiveFrameTarget() {;}
00041     ~InteractiveFrameTarget() {;}
00042 
00043     bool initialize();
00044 
00045     ros::NodeHandle nh_;
00046     tf::TransformListener tf_listener_;
00047     tf::TransformBroadcaster tf_broadcaster_;
00048 
00049 private:
00050     ros::Timer timer_;
00051     double update_rate_;
00052 
00053     std::string root_frame_;
00054     std::string chain_tip_link_;
00055     std::string tracking_frame_;    // the frame tracking the target
00056     std::string target_frame_;      // the frame to be tracked
00057 
00058     bool movable_trans_;
00059     bool movable_rot_;
00060 
00061     interactive_markers::InteractiveMarkerServer* ia_server_;
00062     visualization_msgs::InteractiveMarker int_marker_;
00063     visualization_msgs::InteractiveMarker int_marker_menu_;
00064     interactive_markers::MenuHandler menu_handler_;
00065 
00066     bool tracking_;
00067     bool lookat_;
00068     tf::StampedTransform target_pose_;
00069     boost::mutex mutex_;
00070 
00071     ros::ServiceClient start_tracking_client_;
00072     ros::ServiceClient start_lookat_client_;
00073     ros::ServiceClient stop_client_;
00074 
00075     void updateMarker(const std::string& frame);
00076     void sendTransform(const ros::TimerEvent& event);
00077     void startTracking(const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback);
00078     void startLookat(const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback);
00079     void stop(const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback);
00080     void menuFeedback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback);
00081     void markerFeedback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback);
00082 };
00083 
00084 #endif


cob_frame_tracker
Author(s): Felix Messmer
autogenerated on Thu Jun 6 2019 21:19:08