23 #ifndef EV3_JOINT_SETTINGS_PARAMS_H_
24 #define EV3_JOINT_SETTINGS_PARAMS_H_
29 #include "../../../h4r_ev3_manager/include/h4r_ev3_joint_setup/ev3_joint_settings.h"
35 inline bool getJointSettings(
const std::string& joint_name,
36 Ev3JointSettings::Ev3HwSettings& settings)
42 ros::NodeHandle setup_nh;
43 const std::string joint_setup =
"Ev3devJoints/"+joint_name;
46 if (!setup_nh.hasParam(joint_setup))
48 ROS_WARN_STREAM(
"No ev3 port settings found for ev3 joint '" << joint_name <<
" using velocity mode and automatic port mode");
51 setup_nh = ros::NodeHandle(setup_nh, joint_setup);
53 catch (
const ros::InvalidNameException& e)
55 ROS_ERROR_STREAM(e.what());
59 ROS_INFO_STREAM(
"<--------------EV3 Joint "<<joint_name<<
"---------------->");
63 if(setup_nh.getParam(
"mode", mode))
67 settings.joint_mode=Ev3JointSettings::EV3_JOINT_POSITION;
69 else if(mode==
"velocity")
71 settings.joint_mode=Ev3JointSettings::EV3_JOINT_VELOCITY;
75 ROS_WARN_STREAM(
"Unknown Mode for Ev3 Joint: "<<mode<<
" expecting velocity");
76 settings.joint_mode=Ev3JointSettings::EV3_JOINT_VELOCITY;
78 ROS_INFO_STREAM(
"Joint control mode: "<<mode);
82 if(!setup_nh.getParam(
"driver_name", settings.driver_name))
84 settings.driver_name=
"";
88 ROS_INFO_STREAM(
"Driver_name: "<<settings.driver_name);
93 if(!setup_nh.getParam(
"speed_pid", settings.pid))
95 settings.pid.resize(3);
96 ROS_INFO(
"No PID Settings found, using standard Kp:1000 Ki:60, Kd:0");
103 if(settings.pid.size()!=3)
105 ROS_ERROR(
"PID Settings error! Wrong amount of settings, required exactly 3 for P, I and D");
110 ROS_INFO_STREAM(
"P: "<<settings.pid[0]<<
" I: "<<settings.pid[1]<<
" D: "<<settings.pid[2]);
114 ROS_INFO_STREAM(
"</-------------EV3 Joint "<<joint_name<<
"---------------->");