23 #include "packml_msgs/ItemizedStats.h"    28   : nh_(nh), pn_(pn), sm_(sm)
    69   bool command_rtn = 
false;
    70   bool command_valid = 
true;
    71   int command_int = 
static_cast<int>(req.command);
    79       command_rtn = 
sm_->abort();
    82       command_rtn = 
sm_->clear();
    85       command_rtn = 
sm_->hold();
    88       command_rtn = 
sm_->reset();
    91       command_rtn = 
sm_->start();
    94       command_rtn = 
sm_->stop();
    97       command_rtn = 
sm_->suspend();
   100       command_rtn = 
sm_->unhold();
   103       command_rtn = 
sm_->unsuspend();
   107       command_valid = 
false;
   114       ss << 
"Successful transition request command: " << command_int;
   117       res.error_code = res.SUCCESS;
   118       res.message = ss.str();
   122       ss << 
"Invalid transition request command: " << command_int;
   125       res.error_code = res.INVALID_TRANSITION_REQUEST;
   126       res.message = ss.str();
   131     ss << 
"Unrecognized transition request command: " << command_int;
   134     res.error_code = res.UNRECOGNIZED_REQUEST;
   135     res.message = ss.str();
   145   int cur_state = 
static_cast<int>(args.
value);
   149     status_msg_.sub_state = packml_msgs::State::UNDEFINED;
   162   sm_->getCurrentStatSnapshot(stats_snapshot);
   164   out_stats.idle_duration.data.fromSec(stats_snapshot.
idle_duration);
   165   out_stats.exe_duration.data.fromSec(stats_snapshot.
exe_duration);
   166   out_stats.held_duration.data.fromSec(stats_snapshot.
held_duration);
   167   out_stats.susp_duration.data.fromSec(stats_snapshot.
susp_duration);
   168   out_stats.cmplt_duration.data.fromSec(stats_snapshot.
cmplt_duration);
   169   out_stats.stop_duration.data.fromSec(stats_snapshot.
stop_duration);
   170   out_stats.abort_duration.data.fromSec(stats_snapshot.
abort_duration);
   171   out_stats.duration.data.fromSec(stats_snapshot.
duration);
   172   out_stats.fail_count = stats_snapshot.
fail_count;
   175   out_stats.performance = stats_snapshot.
performance;
   176   out_stats.quality = stats_snapshot.
quality;
   179   out_stats.error_items.clear();
   182     packml_msgs::ItemizedStats stat;
   183     stat.id = itemized_it.second.id;
   184     stat.count = itemized_it.second.count;
   185     stat.duration.data.fromSec(itemized_it.second.duration);
   186     out_stats.error_items.push_back(stat);
   189   out_stats.quality_items.clear();
   192     packml_msgs::ItemizedStats stat;
   193     stat.id = itemized_it.second.id;
   194     stat.count = itemized_it.second.count;
   195     stat.duration.data.fromSec(itemized_it.second.duration);
   196     out_stats.quality_items.push_back(stat);
   204   packml_msgs::Stats stats;
   206   response.stats = stats;
   213   packml_msgs::Stats stats;
   215   response.last_stat = stats;
 std::shared_ptr< packml_sm::AbstractStateMachine > sm_
void publish(const boost::shared_ptr< M > &message) const 
packml_msgs::Status status_msg_
ros::Publisher status_pub_
ros::ServiceServer get_stats_server_
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
ros::ServiceServer reset_stats_server_
PackmlRos(ros::NodeHandle nh, ros::NodeHandle pn, std::shared_ptr< packml_sm::AbstractStateMachine > sm)
std::map< int16_t, PackmlStatsItemized > itemized_quality_map
std::map< int16_t, PackmlStatsItemized > itemized_error_map
void getCurrentStats(packml_msgs::Stats &out_stats)
const std::string & getNamespace() const 
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
#define ROS_DEBUG_STREAM(args)
bool getStats(packml_msgs::GetStats::Request &req, packml_msgs::GetStats::Response &response)
Status initStatus(std::string node_name)
#define ROS_INFO_STREAM(args)
float overall_equipment_effectiveness
void handleStateChanged(packml_sm::AbstractStateMachine &state_machine, const packml_sm::StateChangedEventArgs &args)
bool isStandardState(int state)
#define ROS_ERROR_STREAM(args)
ROSCPP_DECL void spinOnce()
bool transRequest(packml_msgs::Transition::Request &req, packml_msgs::Transition::Response &res)
ros::ServiceServer trans_server_
bool resetStats(packml_msgs::ResetStats::Request &req, packml_msgs::ResetStats::Response &response)