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/virtual_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
00066
00078 int main(int argc, char** argv)
00079 {
00080 ros::init(argc, argv, "shadowhand");
00081 NodeHandle n;
00082
00083 boost::shared_ptr<VirtualShadowhand> virt_sh(new VirtualShadowhand());
00084 boost::shared_ptr<SRSubscriber> shadowhand_subscriber(new SRSubscriber(virt_sh));
00085
00086
00087 boost::shared_ptr<SRPublisher> shadowhand_pub( new SRPublisher(virt_sh));
00088 boost::shared_ptr<SRDiagnosticer> shadowhand_diag( new SRDiagnosticer(virt_sh, sr_hand_hardware));
00089
00090 boost::thread thrd1( boost::bind( &run_diagnotics, shadowhand_diag ));
00091 boost::thread thrd2( boost::bind( &run_publisher, shadowhand_pub ));
00092 thrd1.join();
00093 thrd2.join();
00094
00095 return 0;
00096 }