I want to make NAO grab a ball placed in front of him at (0,0)-(y,z) refrence and placed on the ground, I want the robot to grab it with the right hand (the ball being fit to its hand), for that I have developed the following code (using joint angles based arm movement as stated in the docs: http://doc.aldebaran.com/2-8/family/nao_technical/joints_naov6.html#naov6-joints-right-arm-joints)
nao_ip = "127.0.0.1"
nao_port = 9559
motion_proxy = ALProxy("ALMotion", nao_ip, nao_port)
posture_proxy = ALProxy("ALRobotPosture", nao_ip, nao_port)
posture_proxy.goToPosture("StandInit", 1.0)
motion_proxy.wakeUp()
posture_proxy.goToPosture("Crouch", 1.0)
#bend over to try to grab the ball placed on the ground
motion_proxy.changeAngles("LHipYawPitch", -0.4, 0.1)
time.sleep(5)
#moving the arm accordingly to make it reach the ball isn't sufficient
motion_proxy.setAngles(['RShoulderPitch', 'RShoulderRoll', 'RElbowYaw', 'RElbowRoll', 'RWristYaw', 'RHand'],
[0.6, 0.2, 0.0, 0.0349, 0.0, 0.05], 0.1)
time.sleep(10)
The problem being is that the robot cannot seem to be catching up to where the ball is placed and therefore cannot reach it. Is there a more effective way to make the robot grab the ball based on joint angles ?
PS: the code is easily testable using Choregraph
using a virtual robot (with the IP=127.0.0.1
)