How to get simIK and simOMPL in python?

Typically: "How do I... ", "How can I... " questions
Post Reply
zhengkz
Posts: 17
Joined: 16 Jul 2021, 20:58

How to get simIK and simOMPL in python?

Post by zhengkz »

Hi,

I copy the same command for sim, where

Code: Select all

sim = coppeliasim.bridge.require('sim')
, but it fails on simIK and simOMPL about

Code: Select all

simIK = coppeliasim.bridge.require('simIK')
simOMPL = coppeliasim.bridge.require('simOMPL')
The error is:

Code: Select all

AttributeError: 'NoneType' object has no attribute 'items'
at line 39 of CoppeliaSim_Edu_V4_6_0_rev8_Ubuntu20_04/coppeliasim/bridge.py, where '_info' is None.

I wonder what is the correct way to load these plugs. Thanks!

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: How to get simIK and simOMPL in python?

Post by coppelia »

Hello,

try with following as a workaround:

Code: Select all

    global simIK
    simIK = coppeliasim.bridge.call('scriptClientBridge.require', ['simIK'])
    simIK = coppeliasim.bridge.require('simIK')
The middle command should normally not be needed, and this should be corrected in next revision (rev 10)

Cheers

zhengkz
Posts: 17
Joined: 16 Jul 2021, 20:58

Re: How to get simIK and simOMPL in python?

Post by zhengkz »

I have tried to use

Code: Select all

    simIK = coppeliasim.bridge.call('scriptClientBridge.require', ['simIK'])
    simIK = coppeliasim.bridge.require('simIK')
But it cannot pass a Python function as an argument for validation callback in simIK.generatePath function.
The error is about

Code: Select all

ValueError: cannot serialize unknown object: <function Arm.get_linear_path.<locals>._check_collisions_callback at 0x7f68a0530ca0>
If I use zmq RemoteAPIClient, it can pass the python function as a validation callback function. What should I pass here, and how can I fix it?

Thanks,
Kz

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: How to get simIK and simOMPL in python?

Post by coppelia »

In that situation, callbacks are currently not supported. What is your use case exactly, or why do you need to use Ik or path planning from that location?

There are workarounds for this, but not that straightforward...

Cheers

zhengkz
Posts: 17
Joined: 16 Jul 2021, 20:58

Re: How to get simIK and simOMPL in python?

Post by zhengkz »

I'm using IK to generate linear paths for the robot arm during some manipulation tasks. The callback function is used to check for collisions during planning. I checked the IK and OMPL documents and I didn't find an easier way for collision checking. Is there any demo or example to show how to add collision checking without using validation callback?

Best,
Kz

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: How to get simIK and simOMPL in python?

Post by coppelia »

Right now, if you want to use a state validation callback or simIK.findConfig (also with a validation callback), you'll have to set-up a Python ZeroMQ remote API client in a separate thread.

Otherwise you can use simOMPL.setCollisionPairs, which will internally simply check the two+ entities for collision.

But we can implement the callback functionality for situations like yours... need to evaluate a few options...

Cheers

Post Reply