Error in obtaining handle in Coppeliasim 4.7.0

Typically: "How do I... ", "How can I... " questions
Post Reply
Lnferior
Posts: 25
Joined: 20 Jul 2022, 17:49

Error in obtaining handle in Coppeliasim 4.7.0

Post by Lnferior »

Recently, I downloaded the latest version of Coppeliasim, but during use, I found that the retrieval of handles in the script is not the same as in previous versions, and I did not understand the relevant instructions for obtaining handles in the user manual. During the simulation process, errors also occurred, as shown in the figure. What is the correct method to obtain a handle? Thank you.
Cheers
Image

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

Re: Error in obtaining handle in Coppeliasim 4.7.0

Post by coppelia »

Hello,

handle retrieval is exactly the same as previously: think of your script and all objects as files in a files and folder system: from the location of your script ('.'), you can access its parent ('..'), its grand-parent ('../..'), etc. But you can also access its child with alias 'A' ('./A'). Make sure to carefully read the page on accessing scene objects programmatically for additional details.

In your example, you'r access objects correctly with:

Code: Select all

Base = sim.getObject('..')
J = sim.getObject('../J')
Cheers

Post Reply