https://forum.coppeliarobotics.com/viewtopic.php?f=7&t=179
在lanuch文件中设置
<param name="use_sim_time" value="true"/>
设置该参数为真后,ROS TIME将一直为0直到订阅到节点/clock
,并以/clock
作为ROS TIME
在仿真脚本中发布`/clock’主题
function sysCall_init()
clockpub=simROS.advertise('/clock','rosgraph_msgs/Clock')
simROS.publisherTreatUInt8ArrayAsString(clockpub) -- treat uint8 arrays as strings (much faster, tables/arrays are kind of slow in Lua)
end
function sysCall_sensing()
simROS.publish(clockpub,{clock=sim.getSystemTime()})
end