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