Page 1 of 1

Error Using simSetShapeColor

Posted: 19 Oct 2017, 12:08
by DavideIng
Hello,
I have a problem with simSetShapeColor arguments.
The following is the code to get a color string from Matlab:

Code: Select all

if (sim_call_type==sim_childscriptcall_actuation) then
GotString = simGetStringSignal('ChangeColor')
UnpackedString = simUnpackFloatTable(GotString)
simSetShapeColor(handlePlane,nil,0,UnpackedString)
end
Vrep return this error:

Lua runtime error: [string "SCRIPT Plane0"]:13: One of the function's argument type is not correct. (simSetShapeColor)
stack traceback:
[C]: in function 'simSetShapeColor'
[string "SCRIPT Plane0"]:13: in main chunk

I know that UnpackedString is a 'table floatingNumber' and simSetShapeColor need as a input argument simFloat* rgbData.
Maybe I have to convert UnpackedString in a right input value for simSetShapeColor.
Any suggestion?

Many thanks

Re: Error Using simSetShapeColor

Posted: 19 Oct 2017, 14:39
by coppelia
The function call looks fine. Make sure that handlePlane is a valid object handle, and that UnpackedString is really a table that contains 3 numbers.

Cheers

Re: Error Using simSetShapeColor

Posted: 19 Oct 2017, 15:21
by DavideIng
I checked but doesn't works again.
Vrep Plane1 (primitive shape) Non-Threaded Child Script:

Code: Select all

if(sim_call_type==sim_childscriptcall_initialization) then
simExtRemoteApiStart(20001)
Plane1Handle = simGetObjectHandle('Plane1')
r,initColor=simGetShapeColor(Plane1Handle,nil,0)
SentString = simPackFloatTable(initColor)

end

if (sim_call_type==sim_childscriptcall_actuation) then
GotString = simGetStringSignal('ChangeColor')
UnpackedString = simUnpackFloatTable(GotString)
--simAddStatusbarMessage('word')
simSetShapeColor(Plane1Handle,nil,0,UnpackedString)
 
end

if (sim_call_type==sim_childscriptcall_sensing) then
end

if (sim_call_type==sim_childscriptcall_cleanup) then
end
Any other suggestions?

Many thanks

Re: Error Using simSetShapeColor

Posted: 22 Oct 2017, 12:54
by coppelia
You need to tell us what exactly is not working. If a function fails, make sure to print out the arguments to verify those are exactly what you expect them to be. If they are not, then the error happened further up in the program.

Cheers