Exemplo n.º 1
0
int setForce(TCan *can, float force)
{
	int rval;
	stopMotor(can); /* The motor must be stopped before any changes in the unit mode can be made. */ 
	rval = setUnitMode(can, MODE_TORQUE);
	rval |= startMotor(can);
	rval |= setTorque(can, force);
	return rval;
}
Exemplo n.º 2
0
void	PhysShape::unpack(BitStream* stream)
{
    bool enabled = stream->readFlag();
    if (isEnabled()!=enabled)
        setEnable(enabled);
    if (enabled)
    {
        bool active = stream->readFlag();
        bool toInactive = false;
        if (!active)
        {
            toInactive = stream->readFlag();
            if (!toInactive)
                return;
        }

        if (!isActive())
            setActive(true);
        QuatF q;
        VectorF vec;
        mathRead(*stream, &vec);
        setPosition(vec);
        mathRead(*stream, &q);
        setRotation(q);
        mathRead(*stream, &vec);
        setForce(vec);
        mathRead(*stream, &vec);
        setTorque(vec);
        mathRead(*stream, &vec);
        setLinVelocity(vec);
        mathRead(*stream, &vec);
        setAngVelocity(vec);

        if (toInactive)
            setActive(false);
    }
}
Exemplo n.º 3
0
//===========================================================================
int cMyCustomDevice::setForceAndTorqueAndGripper(cVector3d& a_force, cVector3d& a_torque, double a_gripperTorque)
{
    // temp variables
    int error = 0;
    int result = 0;

    /************************************************************************
        STEP 11:
        Here you may implement code which send a force, torque and gripper
        command at once. For some haptic devices, this is a more optimal
        way of proceeding which limits the amount of data being transfered
        over to the device.

        You may ignore this section in which case the individuals methods
        are called consecutively.
    *************************************************************************/

    // *** INSERT YOUR CODE HERE, MODIFY CODE BELLOW ACCORDINGLY ***

    // send a force command
    m_prevForce = a_force;
    error = setForce(a_force);
    if (error != 0) { result = error; }

    // send a torque command
    m_prevTorque = a_torque;
    error = setTorque(a_torque);
    if (error != 0) { result = error; }

    // send a gripper torque command
    m_prevGripperTorque = a_gripperTorque;
    error = setGripperTorque(a_gripperTorque);
    if (error != 0) { result = error; }

    // exit
    return (result);
}
void PhysicsBodyComponent::setTorque(float x, float y, float z) {
    setTorque(btVector3(x, y, z));
}
Exemplo n.º 5
0
bool PorscheSteeringWheel::setTorqueInNm(double torque)
{
    return (setTorque((int)(torque * scaleTorque)));
}