Auxiliary API

Typically: "How do I... ", "How can I... " questions
Post Reply
hiros
Posts: 6
Joined: 06 May 2020, 03:28

Auxiliary API

Post by hiros »

Hello,

I have two questions.

1.
I'm looking for implementations related to an octree, e.g. sim.insertObjectIntoOctree function.
I expected that the implementations are somewhere in simExtXXX repository at https://github.com/CoppeliaRobotics, however, I could not find related implementations. On the other hand, I could find related functions in Auxiliary API (coppelia geometric routine). Is this the right source to access for learning functions like sim.insertObjectIntoOctree function?

2.
Is it possible to use Auxiliary API from my own code? Are there sample codes to use it?
I'd like to use it with remote API to realize octree manipulation and visualization from my code.
I'm not sure if this is the intended way to use the auxiliary API, but please let me know if I'm wrong. Also, it would be great if you shared how to use the Auxiliary API.

Thanks,

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

Re: Auxiliary API

Post by coppelia »

Hello,

yes, the OC-tree (point-cloud, mesh, collision, distance and proximity sensor) functionality is basically supported via the Coppelia Geometric Routines, wrapped inside of the geometric plugin.

So if you embed the Coppelia Geometric Routines into your own code, then you can have the same functionality as in CoppeliaSim (but only related to OC-Tree, point-cloud, mesh and collision, minimum distance and proximity sensor functionality).

You can also use that functionality via simGeom.-type API functions, if needed. Those functions are unfortunately not documented in current release, but they are duplicated from the C API, with doc here.

Cheers

hiros
Posts: 6
Joined: 06 May 2020, 03:28

Re: Auxiliary API

Post by hiros »

Many thanks for the prompt reply.

I have additional questions about your reply.
So if you embed the Coppelia Geometric Routines into your own code, then you can have the same functionality as in CoppeliaSim (but only related to OC-Tree, point-cloud, mesh and collision, minimum distance and proximity sensor functionality).
I haven't dived into the APIs but let me confirm a few things:
- Is the Coppelia Geometric Routine intended to use from a plugin project? Is it possible to use it from non-plugin project (like with remote API)?
- Is it possible to get shape (or mesh) information from my own code via Coppelia Geometric Routines? I'm wondering how I can use e.g. geom_createOctreeFromMesh. I guess there is a recommended step to use it but I cannot find it.

I'm not familiar with the plugin development, so sorry if my questions are weird for you.
You can also use that functionality via simGeom.-type API functions, if needed. Those functions are unfortunately not documented in current release, but they are duplicated from the C API, with doc here.
You mean the simGeom type API is already available in regular API?
I couldn't find those API here, but I guess simGeom API is available. Is that correct?

Thanks,

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

Re: Auxiliary API

Post by coppelia »

About your questions:
  • the Coppelia Geometric Routines are not exclusively intended to be used from a plugin project. It could be any project (executable, plugin, etc.). Those routines are simple C++ code that can be included and compiled with your own project
  • not sure what you mean in your second question. With the Coppelia Geometric routines you can provide your own mesh data to e.g. geom_createMesh. You can then create other meshes in the same way. You can then check for collision between two meshes with geom_getMeshMeshCollision. You can create an OC-tree via various functions, e.g. geom_createOctreeFromPoints, but you can also create OC-trees from mesh data via geom_createOctreeFromMesh
  • so all listed functions can be used in your own C++ application. But you can also use similar functions directly in CoppeliaSim via simGeom.-type functions.

Cheers

hiros
Posts: 6
Joined: 06 May 2020, 03:28

Re: Auxiliary API

Post by hiros »

Thanks again for your help and support.
the Coppelia Geometric Routines are not exclusively intended to be used from a plugin project. It could be any project (executable, plugin, etc.). Those routines are simple C++ code that can be included and compiled with your own project
Now it's clear, thanks!
not sure what you mean in your second question. With the Coppelia Geometric routines you can provide your own mesh data to e.g. geom_createMesh. You can then create other meshes in the same way. You can then check for collision between two meshes with geom_getMeshMeshCollision. You can create an OC-tree via various functions, e.g. geom_createOctreeFromPoints, but you can also create OC-trees from mesh data via geom_createOctreeFromMesh
Would you be able to simply explain how to use functions like geom_reateMesh?
I'd like to obtain mesh data from CoppeliaSim-side and then I'd like to pass it to geom_ functions.
Is it possible?
so all listed functions can be used in your own C++ application. But you can also use similar functions directly in CoppeliaSim via simGeom.-type functions.
It's good to know, thanks!

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

Re: Auxiliary API

Post by coppelia »

If you use the Coppelia Geometric Routines, you could do something like:

Code: Select all

CObbStruct* shapeA=geome_createMesh(verticesAPtr,verticesASize,indicesAPtr,indicesASize);
CObbStruct* shapeB=geome_createMesh(verticesBPtr,verticesBSize,indicesBPtr,indicesBSize);

C7Vector shapeATransformation;
shapeATransformation.X=C3Vector(1.0,0.0,0.0);
shapeATransformation.Q.setIdentity();

C7Vector shapeBTransformation;
shapeBTransformation.X=C3Vector(1.5,0.0,0.0);
shapeBTransformation.Q.setIdentity();

while (true)
{
    // Move the meshes:
    shapeATransformation.X(0)+=0.01;
    shapeBTransformation.X(0)-=0.01;
    // check for collision between the meshes:
    bool collision=geom_getMeshMeshCollision(shapeA,shapeATransformation,shapeB,shapeBTransformation,);
}
Cheers

hiros
Posts: 6
Joined: 06 May 2020, 03:28

Re: Auxiliary API

Post by hiros »

Thank you for your support as always.
Your sample code is really helpful.

I have one more question regarding your sample code.

Code: Select all

CObbStruct* shapeA=geome_createMesh(verticesAPtr,verticesASize,indicesAPtr,indicesASize);
CObbStruct* shapeB=geome_createMesh(verticesBPtr,verticesBSize,indicesBPtr,indicesBSize);
Is there a way to get vertices info (for input arguments of geom_createMesh()) of objects in the coppeliaSim scene hierarchy via some CoppeliaSim programming functionality? Do I need to create it from scratch?

Thanks,

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

Re: Auxiliary API

Post by coppelia »

You have several functions that allow you to read mesh data in CoppeliaSim, for instance: sim.getShapeMesh, sim.getShapeViz.

Cheers

Post Reply