00001 //============================================================================ 00002 // Name : jaco_arm_driver.cpp 00003 // Author : WPI, Clearpath Robotics 00004 // Version : 0.5 00005 // Copyright : BSD 00006 // Description : A ROS driver for controlling the Kinova Jaco robotic manipulator arm 00007 //============================================================================ 00008 00009 #include "jaco_driver/jaco_api.h" 00010 #include "jaco_driver/jaco_arm.h" 00011 #include "jaco_driver/jaco_pose_action.h" 00012 #include "jaco_driver/jaco_angles_action.h" 00013 #include "jaco_driver/jaco_fingers_action.h" 00014 00015 00016 int main(int argc, char **argv) 00017 { 00018 ros::init(argc, argv, "jaco_arm_driver"); 00019 ros::NodeHandle nh("~"); 00020 boost::recursive_mutex api_mutex; 00021 00022 bool is_first_init = true; 00023 while (ros::ok()) 00024 { 00025 try 00026 { 00027 jaco::JacoComm comm(nh, api_mutex, is_first_init); 00028 jaco::JacoArm jaco(comm, nh); 00029 jaco::JacoPoseActionServer pose_server(comm, nh); 00030 jaco::JacoAnglesActionServer angles_server(comm, nh); 00031 jaco::JacoFingersActionServer fingers_server(comm, nh); 00032 00033 ros::spin(); 00034 } 00035 catch(const std::exception& e) 00036 { 00037 ROS_ERROR_STREAM(e.what()); 00038 jaco::JacoAPI api; 00039 boost::recursive_mutex::scoped_lock lock(api_mutex); 00040 api.closeAPI(); 00041 ros::Duration(1.0).sleep(); 00042 } 00043 00044 is_first_init = false; 00045 } 00046 return 0; 00047 }