Regular API function

simSendData / sim.sendData

Description Deprecated.
C/C++
synopsis
int simSendData(int targetID,int dataHeader,const char* dataName,const char* data,int dataLength,int antennaHandle,double actionRadius,double emissionAngle1,double emissionAngle2,double persistence)
C/C++
parameters
targetID: indicates what receivers will receive the message. Can be sim.handle_all, or the handle of a script
dataHeader: number indicating who "designed" the communication message. Always use the same header (because only you will know the meaning of the message) and stick to it. The best is to use the serial number of your CoppeliaSim copy (check the "Help" menu, in the "About" item for the serial number). Otherwise, you risk collision with other developer's messages which might use the same header as yours.
dataName: name indicating the type of message. dataHeader and dataName will be used to filter out all unwanted messages when trying to receive a specific message (see simReceiveData)
data: data to transmit
dataLength: length of the data to transmit
antennaHandle: handle of the scene object that should operate as the antenna for this transmission. Use sim.handle_default to simulate an antenna coinciding with the world reference frame
actionRadius: radius of the transmission area. If the sender's antenna and receiver's antenna are farther apart than the actionRadius, the receiver can't receive the data
emissionAngle1: opening angle of the transmission area, vertically (along the antenna's z-axis). Value can vary between 0 and pi. If pi, and emissionAngle2 is 2pi, then the transmission area is spherical.
emissionAngle2: opening angle of the transmission area, horizontally (along the antenna's x/y-axis). Value can vary between 0 and 2pi. If 2pi, and emissionAngle1 is pi, then the transmission area is spherical.
persistence: the simulation time duration after which the data is not available to receivers anymore, or 0.0 for a persistence of 1.5*simulationTimeStep (default)
C/C++
return value
-1 if operation was not successful
Lua
synopsis
sim.sendData(int targetID,int dataHeader,string dataName,string data,int antennaHandle=sim.handle_self,number actionRadius=100,float emissionAngle1=3.1415,float emissionAngle2=6.283,float persistence=0)
Lua
parameters
targetID: indicates what receivers will receive the message. Can be sim.handle_all, sim.handle_tree, sim.handle_chain, or the handle of a script. If sim.handle_tree is specified, then only child scripts built on top of current script's hierarchy will be able to receive the message. If sim.handle_chain is specified, then only child scripts parented with current script (or the main script) will be able to receive the message
dataHeader: number indicating who "designed" the communication message. Always use the same header (because only you will know the meaning of the message) and stick to it. The best is to use the serial number of your CoppeliaSim copy (check the "Help" menu, in the "About" item for the serial number). Otherwise, you risk collision with other developer's messages which might use the same header as yours.
dataName: name indicating the type of message. dataHeader and dataName will be used to filter out all unwanted messages when trying to receive a specific message (see sim.receiveData)
data: data to transmit (each character can have values between 0 and 255). See also the data packing/unpacking functions.
antennaHandle: handle of the scene object that should operate as the antenna for this transmission. Use sim.handle_default to simulate an antenna coinciding with the world reference frame, or sim.handle_self to use the object associated with the child script as antenna. Can be omitted (in that case, sim.handle_self is used)
actionRadius: Similar to the C-function counterpart. Can be omitted (in that case 100 is used)
emissionAngle1: Similar to the C-function counterpart. Can be omitted (in that case, pi is used)
emissionAngle2: Similar to the C-function counterpart. Can be omitted (in that case, 2pi is used)
persistence: Similar to the C-function counterpart. Can be omitted (in that case, 0.0 is used)
Lua
return values