Difference between revisions of "BHand library API"
Line 73: | Line 73: | ||
===Providing Motion API=== | ===Providing Motion API=== | ||
+ | <syntaxhighlight lang="cpp"> | ||
+ | //sample code | ||
+ | SetMotionType(eMotionType_HOME) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | <syntaxhighlight lang="cpp"> | ||
+ | eMotionType_NONE, ///< power off | ||
+ | eMotionType_HOME, ///< go to home position | ||
+ | eMotionType_READY, ///< finger position move motion (ready) | ||
+ | eMotionType_GRAVITY_COMP, ///< finger position move motion (gravity compensation) | ||
+ | eMotionType_GRASP_3, ///< grasping using 3 fingers | ||
+ | eMotionType_GRASP_4, ///< grasping using 4 fingers | ||
+ | eMotionType_PINCH_IT, ///< pinching using index finger and thumb | ||
+ | eMotionType_PINCH_MT, ///< pinching using middle finger and thumb | ||
+ | eMotionType_ENVELOP, ///< enveloping | ||
+ | eMotionType_JOINT_PD, ///< joint pd control | ||
+ | </syntaxhighlight> |
Latest revision as of 17:26, 19 June 2019
[edit] BHand Library API
Please refer to the BHand.h in Grasping Library for Linux, "libBHand": Grasping_Library_for_Linux
// Get the type of hand. // @return It returns hand type, whether it is left or right hand. // @see eHandType eHandType GetType(); // Set time interval. // Algorithm assumes UpdateControl() is called once in this time interval. // @param dT Time interval in seconds. void SetTimeInterval(double dT); // Set motion type. // @param motionType Type of motion to set. // @see eMotionType void SetMotionType(int motionType); // Set joint position of each joint. // The hand has sixteen joints totally. // The dimension of 'q' should be sixteen. // This function should be called once in a control loop before UpdateControl() is called. // @param q Array of joint positions in radian. void SetJointPosition(double* q); // Update control algorithm callback. This function should be called in each control time step manually. // Desired joint torques are computed once in every control loop. // @param time Current time in second. void UpdateControl(double time); // Get desired(computed) joint torques. // This function should be called once in a control loop after UpdateControl() is called. // @param tau [out] Array of desired joint torques. void GetJointTorque(double* tau); // Set desired joint position. // @param q Array of desired joint positions in radian. void SetJointDesiredPosition(double* q); // Set scalar for the preset envelop grasp torque. // @param set_scalar will be multiplied by the pre-computed grasping torque // at each joint. Default is one to rest the torque to its original value void SetEnvelopTorqueScalar(double set_scalar=1.0); // Set desired grasping forces. // @param f desired grasping force for each finger void SetGraspingForce(double f[4]); // Set control gains explicitly. // @param kp proportional gains // @param kd derivative gains void SetGainsEx(double* kp, double// kd); // Get forward kinematic solution for each finger. // @param x [out] x coordinate of each fingertip. // @param y [out] y coordinate of each fingertip. // @param z [out] z coordinate of each fingertip. void GetFKResult(double x[4], double y[4], double z[4]); // Get time interval. // Algorithm assumes UpdateControl() is called once in this time interval. // @param dT Time interval in seconds. double GetTimeInterval(); // Get desired grasping forces. // @param fx [out] desired grasping force in x-direction for each finger // @param fy [out] desired grasping force in y-direction for each finger // @param fz [out] desired grasping force in z-direction for each finger void GetGraspingForce(double fx[4], double fy[4], double fz[4]);
[edit] Providing Motion API
//sample code SetMotionType(eMotionType_HOME)
eMotionType_NONE, ///< power off eMotionType_HOME, ///< go to home position eMotionType_READY, ///< finger position move motion (ready) eMotionType_GRAVITY_COMP, ///< finger position move motion (gravity compensation) eMotionType_GRASP_3, ///< grasping using 3 fingers eMotionType_GRASP_4, ///< grasping using 4 fingers eMotionType_PINCH_IT, ///< pinching using index finger and thumb eMotionType_PINCH_MT, ///< pinching using middle finger and thumb eMotionType_ENVELOP, ///< enveloping eMotionType_JOINT_PD, ///< joint pd control
Whos here now: Members 0 Guests 0 Bots & Crawlers 1 |