00001 /* 00002 * Software License Agreement (Apache License) 00003 * 00004 * Copyright (c) 2017 Shaun Edwards 00005 * 00006 * Licensed under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 00019 00020 #ifndef PACKML_ROS_H 00021 #define PACKML_ROS_H 00022 00023 #include <ros/ros.h> 00024 #include <packml_msgs/Status.h> 00025 #include <packml_msgs/Transition.h> 00026 #include <packml_sm/state_machine.h> 00027 00028 00029 namespace packml_ros { 00030 00031 class PackmlRos: public QObject { 00032 Q_OBJECT 00033 00034 public: 00035 PackmlRos(ros::NodeHandle nh, ros::NodeHandle pn, 00036 std::shared_ptr<packml_sm::StateMachine> sm); 00037 void spin(); 00038 void spinOnce(); 00039 00040 protected slots: 00041 00042 void pubState(int value, QString name); 00043 00044 protected: 00045 00046 bool transRequest(packml_msgs::Transition::Request &req, 00047 packml_msgs::Transition::Response &res); 00048 00049 ros::NodeHandle nh_; 00050 ros::NodeHandle pn_; 00051 std::shared_ptr<packml_sm::StateMachine> sm_; 00052 00053 ros::Publisher status_pub_; 00054 ros::ServiceServer trans_server_; 00055 00056 packml_msgs::Status status_msg_; 00057 00058 }; 00059 } // namespace packml_ros 00060 00061 00062 #endif // PACKML_ROS_H