| OPC UA setJointsStr not working- Printable Version +- RoboDK Forum (//www.sinclairbody.com/forum) +-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN) +--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API) +--- Thread: OPC UA setJointsStr not working (/Thread-OPC-UA-setJointsStr-not-working) |
OPC UA setJointsStr not working-terkaa-02-18-2021 Hi, 我们是experimenting with RoboDK OPCUA-server. We are able to transfer StationParameters and StationValues between UAExpert and RoboDK and also we can retrieve current position of robot by calling method getJointsStr. But when calling method setJointsStr we get “succeeded” but robot does not actually move, what might be the problem? String is: -26.260000, -100.000000, 27.470000, 114.000000, -54.280000, 0.000000 Tero RE: OPC UA setJointsStr not working-Albert-02-18-2021 Hi Tero, Using setJointsStr should place the robot at the given joint position without simulating a movement. Also, if the joints you provide are outside the robot limits it is possible that the values will be saturated to show the robot limitations (Fanuc has a virtual coupling for joints 2 and 3). Albert RE: OPC UA setJointsStr not working-terkaa-02-18-2021 Hi, I have been trying to use values received from robot with getJointsStr. So it should be within limits of robot. I have also tried using different robot Kuka KR6 but no luck with that either. Tero Quote:Hi Tero, RE: OPC UA setJointsStr not working-terkaa-02-19-2021 Hi, Are you sure this is not a bug? I did following mods to OPC-UA server code and now it works, BUT still robot position is not updated before I click "View -> Fit all". (02-18-2021, 10:28 AM)Albert Wrote:Hi Tero, RE: OPC UA setJointsStr not working-terkaa-02-19-2021 Problem was that double values fromstring_2_doubles was used with setJoints tJoints needs to be used instead.Here is quick hack that makes it work: staticUA_StatusCodesetJointsStr(void*h,constUA_NodeIdobjectId,size_tinputSize,constUA_Variant*input,size_toutputSize,UA_Variant*output) { PluginOPCUA*plugin= (PluginOPCUA*)h; if(inputSize<2){ qDebug()<<"Inputsize:"<<inputSize<<"Outputsize:"<<outputSize; returnUA_STATUSCODE_BADARGUMENTSMISSING; } QStringstr_item; QStringstr_joints; if(!Var_2_Str(input+0,str_item)){ returnUA_STATUSCODE_BADARGUMENTSMISSING; } if(!Var_2_Str(input+1,str_joints)){ returnUA_STATUSCODE_BADARGUMENTSMISSING; } //ShowMessage(plugin,QObject::tr("itemis:%1").arg(str_item)); ShowMessage(plugin,QObject::tr("positionis:%1").arg(str_joints)); Itemitem=plugin->RDK->getItem(str_item); ShowMessage(plugin,QObject::tr("itemis:%1").arg(item->Name())); if(!plugin->RDK->Valid(item)){//if(!ItemValid(robot)){ ShowMessage(plugin,QObject::tr("setJointsStr:RoboDKItemprovidedisnotvalid")); returnUA_STATUSCODE_BADARGUMENTSMISSING; } double关节[nDOFs_MAX]; item->Joints().GetValues(关节); intnumel=nDOFs_MAX; ShowMessage(plugin,QObject::tr("Numjointis:%1").arg(numel)); string_2_doubles(str_joints,关节, &numel); if(numel<=0){ ShowMessage(plugin,QObject::tr("setJointsStr:Invalid关节string")); returnUA_STATUSCODE_BADARGUMENTSMISSING; } ShowMessage(plugin,QObject::tr("joint1is:3")); tJoints关节2=item->Joints(); for(into=0;o<nDOFs_MAX;o++){//doublevaluesfromarraycannotbeuseddirectlyweneedtousetJointsinstead 关节2.Data()[o] =关节[o]; ShowMessage(plugin,QObject::tr("Joint%1is:%2").arg(o).arg(关节2.Data()[o])); } boolcan_move=item->MoveJ(关节2); if(!can_move){ ShowMessage(plugin,QObject::tr("Therobotcan'tmovetothislocation")); } else{ item->setJoints(关节2); //Sleep(200); plugin->RDK->渲染();} returnUA_STATUSCODE_GOOD; } |