00001 /* 00002 00003 Copyright (c) 2011, Markus Achtelik, ASL, ETH Zurich, Switzerland 00004 You can contact the author at <markus dot achtelik at mavt dot ethz dot ch> 00005 00006 All rights reserved. 00007 00008 Redistribution and use in source and binary forms, with or without 00009 modification, are permitted provided that the following conditions are met: 00010 * Redistributions of source code must retain the above copyright 00011 notice, this list of conditions and the following disclaimer. 00012 * Redistributions in binary form must reproduce the above copyright 00013 notice, this list of conditions and the following disclaimer in the 00014 documentation and/or other materials provided with the distribution. 00015 * Neither the name of ETHZ-ASL nor the 00016 names of its contributors may be used to endorse or promote products 00017 derived from this software without specific prior written permission. 00018 00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00022 DISCLAIMED. IN NO EVENT SHALL ETHZ-ASL BE LIABLE FOR ANY 00023 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00024 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00025 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00026 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00027 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00028 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 00030 */ 00031 00032 #ifndef SSDK_INTERFACE_H_ 00033 #define SSDK_INTERFACE_H_ 00034 00035 #include <ros/ros.h> 00036 #include <tf/transform_datatypes.h> 00037 #include <boost/thread.hpp> 00038 #include <tf/transform_listener.h> 00039 00040 // message includes 00041 #include <asctec_hl_comm/DoubleArrayStamped.h> 00042 #include <geometry_msgs/PoseWithCovarianceStamped.h> 00043 #include <sensor_fusion_comm/ExtState.h> 00044 00045 #include "comm.h" 00046 00047 // dynamic reconfigure includes 00048 #include <dynamic_reconfigure/server.h> 00049 #include <asctec_hl_interface/SSDKConfig.h> 00050 00051 typedef dynamic_reconfigure::Server<asctec_hl_interface::SSDKConfig> SSDKConfigServer; 00052 00054 00061 class SSDKInterface 00062 { 00063 private: 00064 00065 ros::NodeHandle nh_; 00066 ros::NodeHandle pnh_; 00067 CommPtr & comm_; 00068 00069 ros::Publisher debug_pub_; 00070 ros::Publisher pose_pub_; 00071 ros::Subscriber pose_sub_; 00072 ros::Subscriber state_sub_; 00073 00074 std::string frame_id_; 00075 00076 SSDKConfigServer *config_server_; 00077 asctec_hl_interface::SSDKConfig config_; 00078 bool have_config_; 00079 00080 tf::TransformListener tf_listener_; 00081 boost::signals::connection tf_callback_; 00082 00084 void tfCallback(); 00085 00087 void cbPose(const geometry_msgs::PoseWithCovarianceStampedConstPtr &msg); 00088 00090 void cbState(const sensor_fusion_comm::ExtStatePtr & msg); 00091 void sendPoseToAP(const double & x, const double & y, const double & z, const double & yaw, 00092 const unsigned char & qual); 00093 00095 bool sendParameters(const asctec_hl_interface::SSDKConfig & config); 00096 void processDebugData(uint8_t * buf, uint32_t length); 00097 void processStatusData(uint8_t * buf, uint32_t length); 00098 void cbSSDKConfig(asctec_hl_interface::SSDKConfig & config, uint32_t level); 00099 00100 public: 00101 SSDKInterface(ros::NodeHandle & nh, CommPtr & comm); 00102 ~SSDKInterface(); 00103 }; 00104 00105 #endif /* SSDK_INTERFACE_H_ */