Example #1
0
/**
 * TorqueToDAC() - Converts desired torque on each joint to desired DAC level
 *
 * Precondition - tau_d has been set for each joint
 *
 * Postcondition - current_cmd is set for each joint
 * \param device0 pointer to device structure
 *
 */
int TorqueToDAC(struct device *device0)
{
    int i, j;

    // for each arm
    for (i=0; i < NUM_MECH; i++)
        for (j=0; j < MAX_DOF_PER_MECH ; j++) {
            if (device0->mech[i].joint[j].type == NO_CONNECTION_GOLD || device0->mech[i].joint[j].type == NO_CONNECTION_GREEN)
                continue;
            device0->mech[i].joint[j].current_cmd = tToDACVal( &(device0->mech[i].joint[j]) );  // Convert torque to DAC value

            if ( soft_estopped )
                device0->mech[i].joint[j].current_cmd = 0;

        }
    return 0;
}
Example #2
0
/**
 * TorqueToDAC() - Converts desired torque on each joint to desired DAC level
 *
 * Precondition - tau_d has been set for each joint
 *
 * Postcondition - current_cmd is set for each joint
 * \param device0 pointer to device structure
 *
 */
int TorqueToDAC(struct device *device0)
{
	struct DOF *_joint = NULL;
	struct mechanism* _mech = NULL;
    int i=0, j=0;

    // for each arm
    while (loop_over_joints(device0, _mech, _joint, i,j) ) {
    	if (_joint->type == NO_CONNECTION_GOLD || _joint->type == NO_CONNECTION_GREEN)
    		continue;
    	_joint->current_cmd = tToDACVal( _joint );  // Convert torque to DAC value

    	if ( soft_estopped )
    		_joint->current_cmd = 0;

    }
    return 0;
}