// Read arguments ========================================================== void ProgVolumePCA::readParams() { fnVols = getParam("-i"); fnVolsOut = getParam("-o"); NPCA = getIntParam("--Npca"); fnBasis = getParam("--saveBasis"); fnAvgVol = getParam("--avgVolume"); fnOutStack = getParam("--opca"); if (checkParam("--generatePCAVolumes")) getListParam("--generatePCAVolumes",listOfPercentiles); if (checkParam("--mask")) mask.readParams(this); }
bool getJointNames(const std::string joint_list_param, const std::string urdf_param, std::vector<std::string> & joint_names) { joint_names.clear(); // 1) Try to read explicit list of joint names if (ros::param::has(joint_list_param) && getListParam(joint_list_param, joint_names)) { ROS_INFO_STREAM("Found user-specified joint names in '" << joint_list_param << "': " << vec2str(joint_names)); return true; } else ROS_WARN_STREAM("Unable to find user-specified joint names in '" << joint_list_param << "'"); // 2) Try to find joint names from URDF model urdf::Model model; if ( ros::param::has(urdf_param) && model.initParam(urdf_param) && findChainJointNames(model.getRoot(), true, joint_names) ) { ROS_INFO_STREAM("Using joint names from URDF: '" << urdf_param << "': " << vec2str(joint_names)); return true; } else ROS_WARN_STREAM("Unable to find URDF joint names in '" << urdf_param << "'"); // 3) Use default joint-names const int NUM_JOINTS = 6; //Most robots have 6 joints for (int i=0; i<NUM_JOINTS; ++i) { std::stringstream tmp; tmp << "joint_" << i+1; joint_names.push_back(tmp.str()); } ROS_INFO_STREAM("Using standard 6-DOF joint names: " << vec2str(joint_names)); return true; }