xacro if file found
Would it not be very very handy to have xacro conditionals that check if a file can be located? Or if a prior attempt to load a file failed?
My use case is a urdf file with meshes loaded from external CAD files. If the CAD files aren't available, a simple geometric shape can substitute.
<kidding>Hm... Perhaps a conditional that checks available processor and RAM resources would be better... </kidding>
The serious idea is that conditionals are good for dealing with errors. If you write a urdf that can use meshes, but the files associated with that were lost or not in the correct location or there aren't resources to load them or whatever, then a conditional could allow you to substitute a simple shape geometry instead. e.g. "load the geometry from this STL file, but if you can't, it's sort of a cylinder with a box on top like this..."
Perhaps there is already a way to do this that I'm missing?
Is this a serious question?
Not really. It's more of an acknowledgement that what goes wrong sometimes has less to do with the files being missing and more to do with the system not being able to manage the files it's been handed. Happy to remove it if it offends you. The main question, the main /point/ is the idea the conditionals are good for dealing with errors. If you write a urdf that can use meshes, but the files associated with that were lost or not in the correct location or whatever, then a conditional could allow you to substitute a simple shape geometry instead. e.g. "load the geometry from this STL file, but if you can't, or if that file is missing, it's sort of a cylinder with a box on top like this..."