Repository: stepjam/RLBench
Issue: Failed to run examples/swap_arm.py with robot jaco or mico
Root cause: Validation Gap

Thanks for this amazing tool :)
I've tried to execute [examples/swap_arm.py](https://github.com/stepjam/RLBench/blob/master/examples/swap_arm.py) with `jaco` instead.
```python3
env = Environment(
    action_mode, obs_config=obs_config, headless=False,
    robot_setup='jaco')
```
However, when the CoppeliaSim windows popped up, an error occurred:
`[simExtIK:error]   Found invalid joint handle(s)`

same error happens when using `mico`, but works fined with other bots in the support list.
could it be related to #87, #94 or #110 ?

here's the output:
```
Reset Episode
Traceback (most recent call last):
  File "examples/swap_arm.py", line 43, in <module>
    descriptions, obs = task.reset()
  File "/home/lsh18/RLBench/rlbench/task_environment.py", line 77, in reset
    randomly_place=not self._static_positions)
  File "/home/lsh18/RLBench/rlbench/backend/scene.py", line 134, in init_episode
    self.task.validate()
  File "/home/lsh18/RLBench/rlbench/backend/task.py", line 274, in validate
    self._waypoints = self._get_waypoints()
  File "/home/lsh18/RLBench/rlbench/backend/task.py", line 409, in _get_waypoints
    feasible, way_i = self._feasible(waypoints)
  File "/home/lsh18/RLBench/rlbench/backend/task.py", line 360, in _feasible
    path = point.get_path(ignore_collisions=True)
  File "/home/lsh18/RLBench/rlbench/backend/waypoints.py", line 62, in get_path
    algorithm=Algos.RRTConnect)
  File "/home/lsh18/anaconda3/envs/rlbench/lib/python3.7/site-packages/pyrep/robots/arms/arm.py", line 447, in get_path
    relative_to)
  File "/home/lsh18/anaconda3/envs/rlbench/lib/python3.7/site-packages/pyrep/robots/arms/arm.py", line 381, in get_nonlinear_path
    max_configs, distance_threshold, max_time_ms, relative_to)
  File "/home/lsh18/anaconda3/envs/rlbench/lib/python3.7/site-packages/pyrep/robots/arms/arm.py", line 148, in solve_ik_via_sampling
    metric, collision_pairs, joint_options, low_limits, max_limits)
  File "/home/lsh18/anaconda3/envs/rlbench/lib/python3.7/site-packages/pyrep/backend/sim.py", line 1422, in simGetConfigForTipPose
    _check_return(ret)
  File "/home/lsh18/anaconda3/envs/rlbench/lib/python3.7/site-packages/pyrep/backend/sim.py", line 28, in _check_return
    'The call failed on the V-REP side. Return value: %d' % ret)
RuntimeError: The call failed on the V-REP side. Return value: -1
```

Thanks

I had a similar error and it seems like manually swapping out the arm by editing the scene does the trick. 

I'm having the same error while trying to do the OpenDrawer task given the [example](https://github.com/stepjam/RLBench/blob/master/examples/single_task_rl.py) file with the "panda" robot setup. 

Is there a way to fix this without swapping the arm?

Here is the error output:


```shell
  descriptions, obs = task.reset()
  File "/opt/conda/lib/python3.10/site-packages/rlbench/task_environment.py", line 79, in reset
    desc = self._scene.init_episode(
  File "/opt/conda/lib/python3.10/site-packages/rlbench/backend/scene.py", line 136, in init_episode
    self.task.validate()
  File "/opt/conda/lib/python3.10/site-packages/rlbench/backend/task.py", line 274, in validate
    self._waypoints = self._get_waypoints()
  File "/opt/conda/lib/python3.10/site-packages/rlbench/backend/task.py", line 409, in _get_waypoints
    feasible, way_i = self._feasible(waypoints)
  File "/opt/conda/lib/python3.10/site-packages/rlbench/backend/task.py", line 360, in _feasible
    path = point.get_path(ignore_collisions=True)
  File "/opt/conda/lib/python3.10/site-packages/rlbench/backend/waypoints.py", line 55, in get_path
    path = arm.get_path(self._waypoint.get_position(),
  File "/opt/conda/lib/python3.10/site-packages/pyrep/robots/arms/arm.py", line 446, in get_path
    p = self.get_nonlinear_path(
  File "/opt/conda/lib/python3.10/site-packages/pyrep/robots/arms/arm.py", line 387, in get_nonlinear_path
    _, ret_floats, _, _ = utils.script_call(
  File "/opt/conda/lib/python3.10/site-packages/pyrep/backend/utils.py", line 65, in script_call
    return sim.simExtCallScriptFunction(
  File "/opt/conda/lib/python3.10/site-packages/pyrep/backend/sim.py", line 698, in simExtCallScriptFunction
    _check_return(ret)
  File "/opt/conda/lib/python3.10/site-packages/pyrep/backend/sim.py", line 27, in _check_return
    raise RuntimeError(
RuntimeError: The call failed on the V-REP side. Return value: -1
QObject::~QObject: Timers cannot be stopped from another thread
QMutex: destroying locked mutex
```



> I'm having the same error while trying to do the OpenDrawer task given the [example](https://github.com/stepjam/RLBench/blob/master/examples/single_task_rl.py) file with the "panda" robot setup.
> 
> Is there a way to fix this without swapping the arm?
> 
> Here is the error output:
> 
> ```shell
>   descriptions, obs = task.reset()
>   File "/opt/conda/lib/python3.10/site-packages/rlbench/task_environment.py", line 79, in reset
>     desc = self._scene.init_episode(
>   File "/opt/conda/lib/python3.10/site-packages/rlbench/backend/scene.py", line 136, in init_episode
>     self.task.validate()
>   File "/opt/conda/lib/python3.10/site-packages/rlbench/backend/task.py", line 274, in validate
>     self._waypoints = self._get_waypoints()
>   File "/opt/conda/lib/python3.10/site-packages/rlbench/backend/task.py", line 409, in _get_waypoints
>     feasible, way_i = self._feasible(waypoints)
>   File "/opt/conda/lib/python3.10/site-packages/rlbench/backend/task.py", line 360, in _feasible
>     path = point.get_path(ignore_collisions=True)
>   File "/opt/conda/lib/python3.10/site-packages/rlbench/backend/waypoints.py", line 55, in get_path
>     path = arm.get_path(self._waypoint.get_position(),
>   File "/opt/conda/lib/python3.10/site-packages/pyrep/robots/arms/arm.py", line 446, in get_path
>     p = self.get_nonlinear_path(
>   File "/opt/conda/lib/python3.10/site-packages/pyrep/robots/arms/arm.py", line 387, in get_nonlinear_path
>     _, ret_floats, _, _ = utils.script_call(
>   File "/opt/conda/lib/python3.10/site-packages/pyrep/backend/utils.py", line 65, in script_call
>     return sim.simExtCallScriptFunction(
>   File "/opt/conda/lib/python3.10/site-packages/pyrep/backend/sim.py", line 698, in simExtCallScriptFunction
>     _check_return(ret)
>   File "/opt/conda/lib/python3.10/site-packages/pyrep/backend/sim.py", line 27, in _check_return
>     raise RuntimeError(
> RuntimeError: The call failed on the V-REP side. Return value: -1
> QObject::~QObject: Timers cannot be stopped from another thread
> QMutex: destroying locked mutex
> ```

I also meet the same problem when do the **open_oven** task.