<commit_before>import os
import numpy as np
import pydrake
from pydrake.solvers import ik

robot = pydrake.rbtree.RigidBodyTree(os.path.join(pydrake.getDrakePath(), "examples/PR2/pr2.urdf"))
print robot.bodies
print robot.bodies[0]

constraints = [ik.WorldPositionConstraint(robot, 1,
                                          np.zeros((3,)),
                                          np.array([0,0,1.0]),
                                          np.array([0,0,1.0])),
               ik.WorldPositionConstraint(robot, robot.findLink("r_gripper_palm_link").body_index,
                                          np.zeros((3,)),
                                          np.array([0.5,0,1.5]),
                                          np.array([0.5,0,1.5])),
               ]
print constraints

q_seed = robot.getZeroConfiguration()
options = ik.IKoptions(robot)
results = ik.inverseKinSimple(robot, q_seed, q_seed, constraints, options)
print results
print repr(results.q_sol)


# print robot.getBody0()<commit_msg>clean up tests a bit<commit_after>import os
import numpy as np
import pydrake
from pydrake.solvers import ik

robot = pydrake.rbtree.RigidBodyTree(os.path.join(pydrake.getDrakePath(), "examples/PR2/pr2.urdf"))

# Make sure attribute access works on bodies
assert robot.bodies[0].linkname == "world"

constraints = [ik.WorldPositionConstraint(robot, 1,
                                          np.zeros((3,)),
                                          np.array([0,0,1.0]),
                                          np.array([0,0,1.0])),
               ik.WorldPositionConstraint(robot, robot.findLink("r_gripper_palm_link").body_index,
                                          np.zeros((3,)),
                                          np.array([0.5,0,1.5]),
                                          np.array([0.5,0,1.5])),
               ]

q_seed = robot.getZeroConfiguration()
options = ik.IKoptions(robot)
results = ik.inverseKinSimple(robot, q_seed, q_seed, constraints, options)
print repr(results.q_sol)
{'fraction_non_alphanumeric': 0.11895360315893386, 'fraction_numerical': 0.02418558736426456, 'mean_word_length': 1.7026666666666668, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '246121', 'n_tokens_mistral': 597, 'n_tokens_neox': 580, 'n_words': 99}