## [Headless Mode] Cannot run plug in

Report crashes, strange behaviour, or apparent bugs
Rufio2790
Posts: 6
Joined: 11 May 2021, 07:30

### [Headless Mode] Cannot run plug in

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?

coppelia
Posts: 8886
Joined: 14 Dec 2012, 00:25

### Re: [Headless Mode] Cannot run plug in

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

Rufio2790
Posts: 6
Joined: 11 May 2021, 07:30

### Re: [Headless Mode] Cannot run plug in

Hello,

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:
• LuaCmd
• ROS2
• 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?

coppelia
Posts: 8886
Joined: 14 Dec 2012, 00:25

### Re: [Headless Mode] Cannot run plug in

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

Rufio2790
Posts: 6
Joined: 11 May 2021, 07:30

### Re: [Headless Mode] Cannot run plug in

Dear all,

Something like this should be enough to test:

Code: Select all

function sysCall_info()
return {autoStart=false}
end

function sysCall_init()

-- here is where we execute the plug in logic
end

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

coppelia