Page 1 of 1
[Headless Mode] Cannot run plug in
Posted: 01 Jun 2021, 07:21
by Rufio2790
Dear all,
We are trying to run a simulation in headless mode through a plugin + addOn we developed, but we do not find the expected output.
This is the command we are running from the console:
Code: Select all
./coppeliaSim.exe -h -s5000 -q ./roboticSystem.ttt -vdebug -bsimAddOnReachabilitySimulation.lua
The plugin is supposed to read a specific file, run a plug in logic we developed and write a .csv file on disk with the results.
The same procedure works fine when running the simulator normally (and get the paths of input and output files through file dialogs), but the same pluging (with hard-coded paths in the addon) does not produce any output.
Are we missing something? Are we correctly using the cmd line mode?
Thanks in advance
Re: [Headless Mode] Cannot run plug in
Posted: 01 Jun 2021, 10:48
by coppelia
Edit: make sure to first read this
topic about headless mode.
Hello,
is there some error output?
Also, if you add some
print (which should be redirected to the console) or
printToConsole, can you confirm that the
add-on is executing the initialization callback, and the other relevant
system callbacks?
What version of CoppeliaSim and platform are you running?
Cheers
Re: [Headless Mode] Cannot run plug in
Posted: 01 Jun 2021, 11:30
by Rufio2790
Hello,
Thanks for the answer.
We are seeing this problem with CoppeliaSim4.2.0, on both Windows and MacOS platforms.
Actually, we already tried prints in the sys_init callback and we could no see any message in the console.
Comparing the console output between the UI mode and Headless mode, we see that in headless mode we have the following plug in NOT loading:
- CodeEditor (cannot load in headless mode)
- UI(doesn´t work in headless mode)
- URLDrop(doesn´t work in headless mode)
Some are expected, ROS2 is not relevant for our application and we did not check anything about it, but can the unloaded LuaCmd plugin be the issue?
Re: [Headless Mode] Cannot run plug in
Posted: 01 Jun 2021, 12:18
by coppelia
Can you post your add-on, or a minimalistic version of it so that we can test this?
and: all of the above plugins, except for the ROS plugin, can't run in headless mode (that's normal)
Cheers
Re: [Headless Mode] Cannot run plug in
Posted: 01 Jun 2021, 13:43
by Rufio2790
Dear all,
the addOn consist in loading and running a function in a custom plug in.
Something like this should be enough to test:
Code: Select all
function sysCall_info()
return {autoStart=false}
end
function sysCall_init()
print("I'm executing the addon")
sim.addLog(sim.verbosity_msgs,"CHECK EXECUTION")
-- here is where we execute the plug in logic
end
function sysCall_addOnScriptSuspend()
print("Ending... (triggered by the user)")
return {cmd='cleanup'} -- end this add-on. The cleanup section will be called
end
function sysCall_cleanup()
print("Executing the clean-up section")
end
We saw that changing the autoStart to True "solve" the issue, however I think it is mostly a workaround (it executes the addOn correctly without the -b flag in the cmdLine, since it's executed when loaded).
Cheers
Re: [Headless Mode] Cannot run plug in
Posted: 02 Jun 2021, 10:49
by coppelia
Thanks you for that example.
When you manually load an add-on, then simply leave sysCall_info away. Of course if it is an add-on that also gets automatically loaded, and you want only one to automatically start (i.e. the one that was explicitely specified), then that doesn't work. The easiest workaround in that case is to have two distinct add-ons (maybe sharing some common include file).
In a future release the sysCall_info section of explicitly specified add-ons will be ignored.
Cheers