{"action":"created","issue":{"url":"https://api.github.com/repos/robotology/yarp/issues/491","labels_url":"https://api.github.com/repos/robotology/yarp/issues/491/labels{/name}","comments_url":"https://api.github.com/repos/robotology/yarp/issues/491/comments","events_url":"https://api.github.com/repos/robotology/yarp/issues/491/events","html_url":"https://github.com/robotology/yarp/issues/491","id":78999115,"number":491,"title":"[getPid()][setPid()] not working in simulation","user":{"login":"rlober","id":3417094,"avatar_url":"https://avatars.githubusercontent.com/u/3417094?v=3","gravatar_id":"","url":"https://api.github.com/users/rlober","html_url":"https://github.com/rlober","followers_url":"https://api.github.com/users/rlober/followers","following_url":"https://api.github.com/users/rlober/following{/other_user}","gists_url":"https://api.github.com/users/rlober/gists{/gist_id}","starred_url":"https://api.github.com/users/rlober/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlober/subscriptions","organizations_url":"https://api.github.com/users/rlober/orgs","repos_url":"https://api.github.com/users/rlober/repos","events_url":"https://api.github.com/users/rlober/events{/privacy}","received_events_url":"https://api.github.com/users/rlober/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-05-21T13:38:16Z","updated_at":"2015-06-03T13:24:49Z","closed_at":null,"body":"@barbalberto @randaz81 \r\n\r\nI am trying to get (and set) the PID gains for each of the joints on the icub for tuning purposes. Right now my issue is that when I try to read the PID gains for a particular joint the `getPid()` function never works. For reference, I am trying this with iCub_Fixed in Gazebo (I have also tried with iCub_SIM but it told me that PidRaw was not implemented).  My questions are:\r\n-  Can I even call `get`/`setPid()` on the icub simulators? \r\n-  If the answer is yes, then what did I do wrong in the code snippets below?\r\n\r\nIn the following code I open a Poly driver/Pid interface for each of the robot parts, that is why I am using vectors.\r\n**thread.h**\r\n```cpp\r\nstd::vector<PolyDriver*>        robotDevice;\r\nstd::vector<IPidControl*>       iPids;\r\n\r\ndouble Kp, Kd, Ki;\r\n```\r\nIn the implementation I first open the drivers then `view()` the interfaces. Once those are ready I try to call `getPid()` for a single interface and a single joint.\r\n\r\n**thread.cpp**\r\n```cpp\r\n/* initialization */\r\n// numRobotParts = number of icub parts (i.e. head torso etc.) 6 in this case\r\niPids.resize(numRobotParts);\r\n\r\nfor(int rp=0; rp<numRobotParts; rp++)\r\n{\r\n    PolyDriver *tmp_robotDevice = new PolyDriver(options);\r\n    if (!tmp_robotDevice->isValid()) {\r\n        printf(\"Device not available.  Here are the known devices:\\n\");\r\n        printf(\"%s\", Drivers::factory().toString().c_str());\r\n        return false;\r\n    }\r\n    robotDevice.push_back(tmp_robotDevice);\r\n\r\n    if (!robotDevice[rp]->view(iPids[rp])) {\r\n        printf(\"Problems acquiring interfaces\\n\");\r\n        return false;\r\n    }\r\n}\r\n\r\n/* get the PID gains for a particular joint */\r\n// partIndex = the index of the icub part we are looking at e.g. head == 0\r\n// jointIndex = the joint index of said part for which we want to get the Pid\r\n\r\nPid* currentPid;\r\nwhile(!iPids[partIndex]->getPid(jointIndex, currentPid))\r\n{\r\n    Time::delay(0.01);\r\n    std::cout << \"waiting for gains...\" << std::endl;\r\n}\r\n Kp = currentPid->kp;\r\n Kd = currentPid->kd;\r\n Ki = currentPid->ki;\r\n```\r\nWhen I run this code the `getPid()` function never returns true so I get non-stop `waiting for gains...` in my terminal output. Similarly, for the `setPid()` function I have the same results.\r\n\r\nAny ideas where I am going wrong?\r\n\r\nThanks in advance,\r\nRyan\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/robotology/yarp/issues/comments/108408436","html_url":"https://github.com/robotology/yarp/issues/491#issuecomment-108408436","issue_url":"https://api.github.com/repos/robotology/yarp/issues/491","id":108408436,"user":{"login":"randaz81","id":2869969,"avatar_url":"https://avatars.githubusercontent.com/u/2869969?v=3","gravatar_id":"","url":"https://api.github.com/users/randaz81","html_url":"https://github.com/randaz81","followers_url":"https://api.github.com/users/randaz81/followers","following_url":"https://api.github.com/users/randaz81/following{/other_user}","gists_url":"https://api.github.com/users/randaz81/gists{/gist_id}","starred_url":"https://api.github.com/users/randaz81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randaz81/subscriptions","organizations_url":"https://api.github.com/users/randaz81/orgs","repos_url":"https://api.github.com/users/randaz81/repos","events_url":"https://api.github.com/users/randaz81/events{/privacy}","received_events_url":"https://api.github.com/users/randaz81/received_events","type":"User","site_admin":false},"created_at":"2015-06-03T13:24:48Z","updated_at":"2015-06-03T13:24:48Z","body":"* added placeholder implementation of getVelPid() / setVelPid() for embObjMotioncontrol.\r\n* added velocity pid tab in yarpmotorgui"}}