Getting the object handle and position of a cuboid?

Typically: "How do I... ", "How can I... " questions
bilf_machine
Posts: 2
Joined: 18 May 2017, 14:48

Getting the object handle and position of a cuboid?

Postby bilf_machine » 18 May 2017, 16:20

Hi. I'm trying to get the position of a cuboid in my v-rep scene with the python API, but it comes back as [0,0,0]

I noticed my GetObjectHandle also equals 0.

What am I doing wrong here? I know the cuboid is not at [0,0,0]. It's the same for any other cuboids, they all come back as [0,0,0]

Code:

Code: Select all

res, cuboid0Handle=vrep.simxGetObjectHandle(clientID,"Cuboid0",vrep.simx_opmode_blocking)
returnCode,cuboid_position=vrep.simxGetObjectPosition(clientID,cuboid0Handle,-1,vrep.simx_opmode_streaming)


[0.0, 0.0, 0.0]

bilf_machine
Posts: 2
Joined: 18 May 2017, 14:48

Re: Getting the object handle and position of a cuboid?

Postby bilf_machine » 18 May 2017, 18:09

Figured it out. Two reasons:
>I'm retarded
>I was defining those once and calling print once, when the script is first run. If you place them in a while True: statement it will continually run.

Thanks


Return to “General questions”

Who is online

Users browsing this forum: Baidu [Spider] and 23 guests