Add-ons
An add-on is a script running in CoppeliaSim, that can act in a similar way as a plugin:
it is automatically loaded at program start-up, and allows CoppeliaSim's
functionality to be extended by user-written functionality or
functions; it persists across all opened scenes, and is executed
constantly, effectively running in the
background. Add-ons can run threaded or non-threaded, should be segmented into several system callback functions, and follow a precise execution order in relation with other script types. They share a lot of properties with the sandbox script.
Add-ons should be written in a text file located in the
same folder as the main application, with following naming convention: simAddOnXXXX.lua (even add-ons containing Python code). Add-ons that do not follow above naming convention can still be loaded and run via command line options.
By default, add-ons will automatically start when CoppeliaSim starts, e.g.:
function sysCall_init()
print("Executing the initialization section. Starting together with CoppeliaSim")
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
An add-on can also be manually started and stopped from the add-on menu (Lua only), e.g.:
function sysCall_info() return {autoStart=false} end
function sysCall_init()
print("Executing the initialization section. Start triggered by the user")
end
function sysCall_addOnScriptSuspend() print("Ending... (triggered by the user)")
return {cmd='cleanup'} -- end this add-on. end
An add-on can also be suspended/resumed from the add-on menu, e.g.:
...
function sysCall_addOnScriptSuspend() print("Suspending the add-on... (triggered by the user)")
end
function sysCall_addOnScriptResume() print("Resuming the add-on... (triggered by the user)")
end
...
An add-on can also act as a simple function triggered by the user (Lua only), e.g.:
function sysCall_info() return {autoStart=false} end
function sysCall_init()
print("Executing the initialization section. Start triggered by the user")
-- execute some functions here, e.g. import something
return {cmd='cleanup'} -- end this add-on.
end
An add-on can also display a customized name in the Modules' menu (Lua only), e.g.:
function sysCall_info() return {menu='Exporters//My exporter'} end
For more information about add-ons, have a look at the add-ons located in the installation folder.
|