00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00027 #include "../include/IPSA/ipsaclasses.h"
00028 #include "../include/IPSA/viewer/instructions/SetJointForce.h"
00029
00030 #include <cstdlib>
00031
00032
00033 Instruction::tExecResultType SetJointForce::vExecute(std::vector<std::string>& Instr, std::ostringstream& answer, unsigned int& numberOfReturnValues)
00034 {
00035 numberOfReturnValues = 0;
00036 tExecResultType res = eBODY_NOT_FOUND;
00037 SoJoint* joint = Instruction::GetNodeOfTypeByName<SoJoint*>(Instr[1]);
00038 if (joint)
00039 {
00040 #ifndef WIN32
00041 const float FORCE = strtof(Instr[2].c_str(), NULL);
00042 #else
00043 const float FORCE = (float)strtod(Instr[2].c_str(), NULL);
00044 #endif
00045 joint->setForce(FORCE);
00046 res = eOK;
00047 }
00048 else
00049 res = eJOINT_TYPE_INCOMPATIBLE;
00050
00051 return res;
00052 }