int main(int argc, char** argv) { // Message to user printf("\n" " *** Barrett WAM Autotensioning Utility ***\n" "\n" "This utility will autotension the specified cables of your WAM Arm.\n" "Cable tensioning is necessary after signs of the WAM cables becoming\n" "loose after extended use, or after replacing any cables on your WAM Arm.\n" "After completion of this routine, you must zero calibrate and gravity\n" "calibrate the WAM, as pulling tension from the cables will introduce\n" "offsets to your previous calibrations.\n" "\n" "WAMs with serial numbers < 5 and WAM wrists with serial numbers < 9 are not\n" "eligible for autotensioning.\n" "\n" "This program assumes the WAM is mounted such that the base is horizontal.\n" "\n" "\n"); // For clean stack traces barrett::installExceptionHandler(); // Create our product manager ProductManager pm; pm.waitForWam(); if (pm.foundWam4()) { return wam_main<4>(argc, argv, pm, *pm.getWam4(true, NULL)); } else if (pm.foundWam7()) { return wam_main<7>(argc, argv, pm, *pm.getWam7(true, NULL)); } }
boost::thread startWam(ProductManager& pm, boost::function<void (ProductManager&, systems::Wam<4>&)> wt4, boost::function<void (ProductManager&, systems::Wam<7>&)> wt7) { pm.waitForWam(); pm.wakeAllPucks(); if (pm.foundWam4()) { return boost::thread(wt4, boost::ref(pm), boost::ref(*pm.getWam4())); } else { return boost::thread(wt7, boost::ref(pm), boost::ref(*pm.getWam7())); } }
int main() { ProductManager pm; SafetyModule& sm = *pm.getSafetyModule(); SafetyModule::PendantState ps; // Optional: Instantiate a Wam object and start the realtime control loop if (pm.foundWam4()) { pm.getWam4(false); } else { pm.getWam7(false); } while (true) { sm.getPendantState(&ps); std::cout << ps.toString() << " " << ps.allSafe() << " " << ps.hasFaults() << "\n"; usleep(1000000); } return 0; }