iri_wam_joint_move_fake_recorder.cpp
Go to the documentation of this file.
00001 #include "ros/ros.h"
00002 #include "iri_fake_recorder.h"
00003 #include <iri_wam_common_msgs/joints_move.h>
00004 #include <string>
00005 #include <cstring>
00006 
00007 template<size_t DOF>
00008 class WamJointMoveFakeRecorder : public IRIFakeRecorder<std::vector<double> >
00009 {
00010     private:
00011         ros::NodeHandle    nh_;
00012         ros::ServiceServer joints_move_server_;
00013         std::string        server_uri_;
00014         size_t             dof_;
00015 
00016 
00017         bool joints_moveCallback(iri_wam_common_msgs::joints_move::Request &req,
00018                                  iri_wam_common_msgs::joints_move::Response &res);
00019 
00020     public:
00021         WamJointMoveFakeRecorder(const std::string server_uri);
00022 };
00023 
00024 template<size_t DOF>
00025 WamJointMoveFakeRecorder<DOF>::WamJointMoveFakeRecorder(const std::string server_uri) :
00026     server_uri_(server_uri),
00027     dof_(DOF)
00028 {
00029     joints_move_server_ = nh_.advertiseService(server_uri_, &WamJointMoveFakeRecorder::joints_moveCallback, 
00030                                                this);
00031 }
00032 
00033 template<size_t DOF>
00034 bool
00035 WamJointMoveFakeRecorder<DOF>::joints_moveCallback(iri_wam_common_msgs::joints_move::Request &req,
00036                                                    iri_wam_common_msgs::joints_move::Response &res)
00037 {
00038     if (req.joints.size() != dof_)
00039     {
00040         std::cerr << "Invalid number of joints for moving: " << req.joints.size()
00041                   << " Expected: " << dof_;
00042         return false;
00043     }
00044 
00045     msg_recieved_history_.push_back(req.joints);
00046     return true;
00047 }


iri_grasp_actions
Author(s): pmonso
autogenerated on Fri Dec 6 2013 20:14:56