BarretHand simTubeOpen failed.

Typically: "How do I... ", "How can I... " questions
Post Reply
xixiying
Posts: 1
Joined: 26 Jul 2017, 02:03

BarretHand simTubeOpen failed.

Post by xixiying » 26 Jul 2017, 10:09

Hi, I have several BarretHands in one scene. Some of them are ok while some are not. I used the script
communicationTube=simTubeOpen(0,'BarrettGripperState'..simGetNameSuffix(nil),1)
status, rpcnt, wpcnt = simTubeStatus(communicationTube)
It seems that simTubeOpen is not successful with the 'status' of value -1.
Can somebody give me some clues and suggestions?
Thanks a lot!

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

Re: BarretHand simTubeOpen failed.

Post by coppelia » 28 Jul 2017, 07:06

Hello,

I suspect you are trying to open a tube with the same dataName several times.
Instead of using tubes, you could also use signals, or directly write a variable in another script with simSetScriptVariable.
Yet another option would be to have objectA write a value into objectB with:

Code: Select all

local myVariable={}
myVariable.openGripper=true
simWriteCustomDataBlock(objectB,'myData',simPackTable(myVariable))
and check on a regular base in objectB that value with:

Code: Select all

local data=simReadCustomDataBlock(objectB,'myData')
if data then
    local myVariable=simUnpackTable(data)
    if myVariable.openGripper then
        ...
    else
        ...
    end
end
Cheers

Post Reply