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/SetJointSpeed.h"
00029
00030
00031 Instruction::tExecResultType SetJointSpeed::vExecute(std::vector<std::string>& Instr, std::ostringstream& answer, unsigned int& numberOfReturnValues)
00032 {
00033 numberOfReturnValues = 0;
00034 tExecResultType res = eJOINT_NOT_FOUND;
00035 SoNode * node = SoNode::getByName(Instr[1].c_str());
00036 if (node != NULL)
00037 {
00038 if (node->getTypeId()==SoJointHinge::getClassTypeId())
00039 {
00040 SoJointHinge* joint = (SoJointHinge *)node;
00041 joint->Velocity.set(Instr[2].c_str());
00042 res = eOK;
00043 }
00044 else if (node->getTypeId()==SoJointHinge2::getClassTypeId())
00045 {
00046 SoJointHinge2* joint = (SoJointHinge2 *)node;
00047 joint->Velocity.set(Instr[2].c_str());
00048 res = eOK;
00049 }
00050 else if (node->isOfType(SoJointSlider::getClassTypeId()))
00051 {
00052 SoJointSlider* joint = (SoJointSlider *)node;
00053 joint->Velocity.set(Instr[2].c_str());
00054 res = eOK;
00055 }
00056 else
00057 res = eJOINT_TYPE_INCOMPATIBLE;
00058 }
00059 return res;
00060 }