ArmComponentsNameManager.h
Go to the documentation of this file.
00001 #ifndef ARM_COMPONENTS_NAME_MANAGER_ARMCOMPONENTSNAMEMANAGER_H
00002 #define ARM_COMPONENTS_NAME_MANAGER_ARMCOMPONENTSNAMEMANAGER_H
00003 
00004 #ifdef DOXYGEN_SHOULD_SKIP_THIS
00005 
00024 #endif
00025 
00026 #include <string>
00027 #include <vector>
00028 #include <sensor_msgs/JointState.h>
00029 #include <ros/ros.h>
00030 
00031 namespace arm_components_name_manager
00032 {
00033 
00100 class ArmComponentsNameManager
00101 {
00102 public:
00109     ArmComponentsNameManager(const std::string& robot_namespace, bool readParams);
00110     ArmComponentsNameManager(const ArmComponentsNameManager& o);
00111 
00122     int loadParameters(bool printErrors=true, bool verbose=false);
00123 
00134     bool waitToLoadParameters(int sufficientSuccessCode, float maxWait, float waitStep=0.1);
00135 
00141     bool loadDefaults();
00142 
00147     int parametersLoaded()
00148     {
00149         return initParamCode;
00150     }
00151 
00155     bool defaultsLoaded()
00156     {
00157         return initWithDefaults;
00158     }
00159 
00164     void getJointNames(std::vector<std::string>& joint_names,
00165                        bool withGripper, const std::string& prepend = std::string()) const;
00166 
00167     const std::vector<std::string>& getArmJoints() const;
00168 
00169     const std::vector<std::string>& getGripperJoints() const;
00170 
00171     const std::vector<float>& getArmJointsInitPose() const;
00172 
00173     const std::vector<float>& getGripperJointsInitPose() const;
00174 
00178     const std::vector<std::string>& getGripperLinks() const;
00179 
00188     const std::string& getPalmLink() const;
00189     
00195     const std::string& getEffectorLink() const;
00196 
00200     const std::vector<std::string>& getArmLinks() const;
00201 
00202 
00208 //    void initJointState(sensor_msgs::JointState& js, bool withGripper = true,
00209 //                        const std::vector<float> * init_poses = NULL) const;
00210 
00223     void copyToJointState(sensor_msgs::JointState& js, int mode, const std::vector<float> * init_vals, int copyData, bool resetAll) const;
00224 
00225 
00233     bool extractFromJointState(const sensor_msgs::JointState& js, int mode, std::vector<float>& data, int extractData) const;
00234     bool extractFromJointState(const sensor_msgs::JointState& js, int mode, sensor_msgs::JointState& result) const;
00235 
00250     int getJointIndices(const std::vector<std::string>& joint_names, std::vector<int>& idx) const;
00251 
00257     bool getJointIndices(const std::vector<std::string>& joint_names, std::vector<int>& idx, int mode) const;
00258 
00259     int numArmJoints() const;
00260     int numGripperJoints() const;
00261     int numTotalJoints() const
00262     {
00263         return numArmJoints() + numGripperJoints();
00264     }
00268     bool isGripper(const std::string& name) const;
00269 
00274     int armJointNumber(const std::string& name) const;
00275 
00280     int gripperJointNumber(const std::string& name) const;
00281 
00291     void ReadPIDValues(const std::string& pidParameterName, float& kp, float& ki, float& kd) const;
00292 
00300     bool GetPosGains(const std::string& jointName, float& kp, float& ki, float& kd) const;
00301 
00305     bool GetVelGains(const std::string& jointName, float& kp, float& ki, float& kd) const;
00306 
00307 
00311     virtual bool GetMaxVals(const std::string& jointName, float& force, float& velocity) const;
00312 
00313 
00329     void setValues(const std::string& _palm_link,
00330                    const std::string& _effector_link,
00331                    const std::vector<std::string>& _arm_joints, const std::vector<std::string>& _arm_links,
00332                    const std::vector<std::string>& _gripper_joints, const std::vector<std::string>& _gripper_links,
00333                    const std::vector<float>& _arm_joint_init, const std::vector<float>& _gripper_joint_init);
00334 
00340     void setControllerNames(const std::vector<std::string>& controller_names, bool forArm, int type);
00341 
00346     virtual bool hasDefaults()
00347     {
00348         return false;
00349     }
00350 
00351 protected:
00352 
00353     virtual std::string getDefaultPalmLink() const { return std::string(); }
00354     virtual std::string getDefaultEffectorLink() const { return std::string(); }
00355     virtual std::vector<std::string> getDefaultArmJoints() const { return std::vector<std::string>(); }
00356     virtual std::vector<std::string> getDefaultArmLinks() const { return std::vector<std::string>(); }
00357     virtual std::vector<std::string> getDefaultGripperJoints() const { return std::vector<std::string>(); }
00358     virtual std::vector<std::string> getDefaultGripperLinks() const { return std::vector<std::string>(); }
00359     virtual std::vector<float> getDefaultArmJointsInitPose() const { return std::vector<float>(); }
00360     virtual std::vector<float> getDefaultGripperJointsInitPose() const { return std::vector<float>(); }
00361     virtual std::vector<float> getDefaultArmJointsMaxVel() const { return std::vector<float>(); }
00362     virtual std::vector<float> getDefaultArmJointsMaxForce() const { return std::vector<float>(); }
00363     virtual std::vector<float> getDefaultGripperJointsMaxVel() const { return std::vector<float>(); }
00364     virtual std::vector<float> getDefaultGripperJointsMaxForce() const { return std::vector<float>(); }
00365 
00366 private:
00367 
00368     ArmComponentsNameManager();
00369 
00376     std::vector<std::string> arm_joints;
00377 
00383     std::vector<std::string> arm_links;
00384 
00390     std::vector<std::string> gripper_joints;
00391 
00392 
00398     std::vector<std::string> gripper_links;
00399 
00410     std::string palm_link;
00411     
00417     std::string effector_link;
00418 
00423     std::vector<float> arm_joint_init;
00424 
00429     std::vector<float> gripper_joint_init;
00430    
00434     std::vector<float> arm_joint_max_vel;
00438     std::vector<float> arm_joint_max_force;
00442     std::vector<float> gripper_joint_max_vel;
00446     std::vector<float> gripper_joint_max_force;
00447 
00448     std::vector<std::string> arm_effort_controller_names;
00449     std::vector<std::string> arm_velocity_controller_names;
00450     std::vector<std::string> arm_position_controller_names;
00451 
00452     std::vector<std::string> gripper_effort_controller_names;
00453     std::vector<std::string> gripper_velocity_controller_names;
00454     std::vector<std::string> gripper_position_controller_names;
00455 
00456     std::string robot_namespace;
00457 
00466     int initParamCode;
00467 
00471     bool initWithDefaults;
00472 };
00473 }  // namespace
00474 #endif  // ARM_COMPONENTS_NAME_MANAGER_ARMCOMPONENTSNAMEMANAGER_H


arm_components_name_manager
Author(s): Jennifer Buehler
autogenerated on Sat Mar 2 2019 03:21:40