Child script name and location

Typically: "How do I... ", "How can I... " questions
Post Reply
pinecone
Posts: 3
Joined: 10 Mar 2019, 05:32

Child script name and location

Post by pinecone »

I am new to vrep and am streamlining my workspace for tracking on git. Currently my robot is controllable via ros interface and also a UI that I made. The controls for these are written in non-threaded child scripts, and to switch between the two I have to manually associate the robot object with the relevant lua script in the script menu. I would like a way to

1) Rename scripts so that doing this is less confusing (currently they're both called 'non-threaded child script'); and
2) Associate scripts stored as text files with my single scene file upon execution of vrep. That way I don't have to track/version control a 13mb scene file just to store a few kilobytes of lua script.

I imagine that 1) is just an issue of me not being able to find the correct button or something in the UI. The ideal user experience for 2) would be something like running a bash script that starts vrep with my scene loaded and with the desired child-script attached to my robot, while tracking only a single scene file in my git repo, but multiple scripts.

Does anyone have a setup like this?

coppelia
Site Admin
Posts: 10360
Joined: 14 Dec 2012, 00:25

Re: Child script name and location

Post by coppelia »

Hello,

unless I misunderstood something, the solution for you would be to use following in your non-threaded child script:

Code: Select all

require('pathToMyScriptFile')
where pathToMyScriptFile could be /lua/myScript if your script file is /lua/myScript.lua

Then you could have:

Code: Select all

require('/lua/'..sim.getStringParameter(sim.stringparam_app_arg1))
where sim.getStringParameter(sim.stringparam_app_arg1) represents the first parameter passed to V-REP command-line via the -g option.

Cheers

Post Reply