stepjam / PyRep

A toolkit for robot learning research.
MIT License
687 stars 163 forks source link

solve_ik error with my added robot #183

Closed takeru1205 closed 4 years ago

takeru1205 commented 4 years ago

Hi there,

I added Dobot Magician environment. I want to use solve_ik method but it can get an error.

from os.path import dirname, join, abspath
from pyrep import PyRep
from pyrep.robots.arms.dobot import Dobot

SCENE_FILE = join(dirname(abspath(__file__)), 'dobot_env.ttt')

DELTA = 0.01
pr = PyRep()
pr.launch(SCENE_FILE, headless=False)
pr.start()
agent = Dobot()
starting_joint_positions = agent.get_joint_positions()
pos, quat = agent.get_tip().get_position(), agent.get_tip().get_quaternion()

def move(index, delta):
    pos[index] += delta
    new_joint_angles = agent.solve_ik(pos, quaternion=quat)
    agent.set_joint_target_positions(new_joint_angles)
    pr.step()

[move(2, -DELTA) for _ in range(20)]
[move(1, -DELTA) for _ in range(20)]
[move(2, DELTA) for _ in range(10)]
[move(1, DELTA) for _ in range(20)]

pr.stop()
pr.shutdown()

And I got error below.

Traceback (most recent call last):
  File "dobot_ik.py", line 23, in <module>
    [move(2, -DELTA) for _ in range(20)]
  File "dobot_ik.py", line 23, in <listcomp>
    [move(2, -DELTA) for _ in range(20)]
  File "dobot_ik.py", line 18, in move
    new_joint_angles = agent.solve_ik(pos, quaternion=quat)
  File "/home/takeru/.local/lib/python3.7/site-packages/pyrep/robots/arms/arm.py", line 140, in solve_ik
    raise IKError('IK failed. Perhaps the distance was between the tip '
pyrep.errors.IKError: IK failed. Perhaps the distance was between the tip  and target was too large.

And this is my scene_file.

The code is refer to this panda example code. I only changed to my dobot scene.

If you have any ideas, please help me.

Thank you.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

njanirudh commented 4 years ago

Hi were you able to solve this issue

takeru1205 commented 4 years ago

Unfortunately, I couldn't solve this issue.