Go to the documentation of this file.00001
00030 #include <ros/ros.h>
00031
00032 #include <boost/thread.hpp>
00033 #include <boost/smart_ptr.hpp>
00034
00035 #include "sr_hand/sr_subscriber.h"
00036 #include "sr_hand/sr_publisher.h"
00037 #include "sr_hand/sr_diagnosticer.h"
00038
00039 #include "sr_hand/hand/real_shadowhand.h"
00040
00041 using namespace std;
00042 using namespace ros;
00043 using namespace shadowrobot;
00044
00045
00047
00049
00050 void run_diagnotics(boost::shared_ptr<SRDiagnosticer> shadowhand_diag)
00051 {
00052 while( ok() )
00053 {
00054 shadowhand_diag->publish();
00055 }
00056 }
00057
00058 void run_publisher(boost::shared_ptr<SRPublisher> shadowhand_pub)
00059 {
00060 while( ok() )
00061 {
00062 shadowhand_pub->publish();
00063 }
00064 }
00065
00077 int main(int argc, char** argv)
00078 {
00079 ros::init(argc, argv, "shadowhand");
00080 NodeHandle n;
00081
00082 boost::shared_ptr<RealShadowhand> real_sh(new RealShadowhand());
00083 boost::shared_ptr<SRSubscriber> shadowhand_subscriber(new SRSubscriber(real_sh));
00084
00085
00086 boost::shared_ptr<SRPublisher> shadowhand_pub( new SRPublisher(real_sh));
00087 boost::shared_ptr<SRDiagnosticer> shadowhand_diag( new SRDiagnosticer(real_sh, sr_hand_hardware));
00088
00089 boost::thread thrd1( boost::bind( &run_diagnotics, shadowhand_diag ));
00090 boost::thread thrd2( boost::bind( &run_publisher, shadowhand_pub ));
00091 thrd1.join();
00092 thrd2.join();
00093
00094 return 0;
00095 }