{"action":"created","issue":{"url":"https://api.github.com/repos/uArm-Developer/UArmForArduino/issues/1","labels_url":"https://api.github.com/repos/uArm-Developer/UArmForArduino/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/uArm-Developer/UArmForArduino/issues/1/comments","events_url":"https://api.github.com/repos/uArm-Developer/UArmForArduino/issues/1/events","html_url":"https://github.com/uArm-Developer/UArmForArduino/issues/1","id":118460279,"number":1,"title":"The problem with getCalZ();","user":{"login":"jaewooklee93","id":11328376,"avatar_url":"https://avatars.githubusercontent.com/u/11328376?v=3","gravatar_id":"","url":"https://api.github.com/users/jaewooklee93","html_url":"https://github.com/jaewooklee93","followers_url":"https://api.github.com/users/jaewooklee93/followers","following_url":"https://api.github.com/users/jaewooklee93/following{/other_user}","gists_url":"https://api.github.com/users/jaewooklee93/gists{/gist_id}","starred_url":"https://api.github.com/users/jaewooklee93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaewooklee93/subscriptions","organizations_url":"https://api.github.com/users/jaewooklee93/orgs","repos_url":"https://api.github.com/users/jaewooklee93/repos","events_url":"https://api.github.com/users/jaewooklee93/events{/privacy}","received_events_url":"https://api.github.com/users/jaewooklee93/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-23T19:59:10Z","updated_at":"2015-11-24T04:39:17Z","closed_at":null,"body":"You might already notice that the getCalZ() returned wrong results as you wrote in the manual. I guess that is due to the wrong value of theta_3 at calXYZ function.\r\n\r\nI simply added an offset(+23) for theta_3 at the first line of calXYZ. Then it returns seemingly more accurate value of Z-coordinate of end-effector.\r\n\r\nAt **uArm_library.cpp**\r\n```\r\nvoid uArmClass::calXYZ(double theta_1, double theta_2, double theta_3)\r\n{\r\ntheta_3+=23;\r\n\r\n  g_theta_1=theta_1;\r\n  g_theta_2=theta_2;\r\n  g_theta_3=theta_3;\r\n\r\n  g_l3_1 = MATH_L3 * cos(theta_2 / MATH_TRANS);\r\n  g_l4_1 = MATH_L4*cos(theta_3 / MATH_TRANS);\r\n  g_l5 = (MATH_L2 + MATH_L3*cos(theta_2 / MATH_TRANS) + MATH_L4*cos(theta_3 / MATH_TRANS));\r\n\r\n  g_cal_x = -cos(abs(theta_1 / MATH_TRANS))*g_l5;\r\n  g_cal_y = -sin(abs(theta_1 / MATH_TRANS))*g_l5;\r\n  g_cal_z = MATH_L1 + MATH_L3*sin(abs(theta_2 / MATH_TRANS)) - MATH_L4*sin(abs(theta_3 / MATH_TRANS));\r\n\r\n}\r\n```\r\n\r\nI'm a beginner of uarm, so my point may not be correct, but I hope that this comment may help you solve the problem.\r\n\r\nThank you.\r\nJaewook Lee"},"comment":{"url":"https://api.github.com/repos/uArm-Developer/UArmForArduino/issues/comments/159147800","html_url":"https://github.com/uArm-Developer/UArmForArduino/issues/1#issuecomment-159147800","issue_url":"https://api.github.com/repos/uArm-Developer/UArmForArduino/issues/1","id":159147800,"user":{"login":"jaewooklee93","id":11328376,"avatar_url":"https://avatars.githubusercontent.com/u/11328376?v=3","gravatar_id":"","url":"https://api.github.com/users/jaewooklee93","html_url":"https://github.com/jaewooklee93","followers_url":"https://api.github.com/users/jaewooklee93/followers","following_url":"https://api.github.com/users/jaewooklee93/following{/other_user}","gists_url":"https://api.github.com/users/jaewooklee93/gists{/gist_id}","starred_url":"https://api.github.com/users/jaewooklee93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaewooklee93/subscriptions","organizations_url":"https://api.github.com/users/jaewooklee93/orgs","repos_url":"https://api.github.com/users/jaewooklee93/repos","events_url":"https://api.github.com/users/jaewooklee93/events{/privacy}","received_events_url":"https://api.github.com/users/jaewooklee93/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T04:39:17Z","updated_at":"2015-11-24T04:39:17Z","body":"Thank you for your quick response.\r\n\r\nHowever, I think the problem lies not only on the definition of (x,y,z). \r\n\r\nI tried **Get XYZ Example** in http://developer.ufactory.cc/quickstart/\r\nJust at the calibration posture (servo1,servo2,servo3)=(45,130,20), It displays\r\n```The current location is -7 , -3 , 21```\r\n![default](https://cloud.githubusercontent.com/assets/11328376/11357933/792cba0c-92b0-11e5-8b6b-70e9866a1bf4.PNG)\r\n\r\nHowever, when I move the end-effector upward while remaining servo1, servo2 static, or simply (servo1,servo2,servo3)=(45,130,0), it displays\r\n```The current location is -6 , -2 , 15```\r\n![2](https://cloud.githubusercontent.com/assets/11328376/11357934/7cc025e6-92b0-11e5-8e1b-16d81920373d.PNG)\r\n\r\nHowever, z-coordinate should increase during this motion.\r\n\r\nFor reference, this is my calibration result.\r\n```\r\nc\r\nl_address: 60\r\nservo 1\r\nlr.getA():-31.37\r\nlr.getB():0.36\r\nl_address: 66\r\nservo 2\r\nlr.getA():-27.94\r\nlr.getB():0.35\r\nl_address: 72\r\nservo 3\r\nlr.getA():-30.87\r\nlr.getB():0.36\r\nl_address: 78\r\nservo 4\r\nlr.getA():-41.12\r\nlr.getB():0.50\r\nPut uarm in calibration posture (servo 1 to 3: 45, 130, 20 degree respectively), then input 1\r\nOffsets for servo 1 to 3 are -5.60\r\n9.40\r\n-11.95\r\nSave offset done! \r\nAll done!\r\n```\r\n\r\nI think this may be related to the calibration function newly updated in the last week.\r\n\r\nBest regards,\r\nJaewook Lee"}}