What is the recommended way to get the full path to the programs directory from inside a URCap? We would like to implement a solution that works on the real robot and in the simulator, so we cannot hardcode “/programs” as a string.
I could use a Linux system call e.g. “pwd” but it looks like a quick and dirty hack.
You could check if the “/programs” folder exists, if it doesn’t reroute the path to the simulator folder which by default should be “/home/ur/ursim-current/programs”.
if you want to check: realRobot / simulation
true if controlling the real, physical robot and false if in simulation mode.
You can connect to the Dashboard Server, send the command
get loaded program and extract the programs path from the returned value.